Branch: Tag:

2015-01-19

2015-01-19 12:16:24 by Martin Nilsson <nilsson@opera.com>

Don't allow non-zero padding in bitstrings. This change is not fully backwards compatible.

548:       if (unused >= 8)    return 0; +     value = contents[1..]; -  +  +  // Unused bits should be zero. I can't find anything in X.690 that +  // explicitly states this though. +  if (sizeof(value) && unused && value[-1]&(1<<unused)-1) +  return 0; +     return this;    }   
563:    if( unused ) error("Adding to a non-aligned bit stream.\n");    value += e->value;    unused = e->unused; +  +  // Unused bits should be zero. I can't find anything in X.690 that +  // explicitly states this though. +  if (sizeof(value) && unused && value[-1]&(1<<unused)-1) +  error("Non-zero padding bits.\n");    }       protected string _sprintf(int t) {