Fix mask matching to check for proper range
Don't use uint8_t since it's not supported by MSVC
if(end==str.end())
throw InvalidParameterValue("Unmatched '['");
- uint8_t mask[32]={0};
+ unsigned char mask[32]={0};
unsigned type=0;
bool range=false;
unsigned char first=0, last=0;
}
else if(instr==MATCH_MASK)
{
- uint8_t mask[32];
- for(unsigned k=0; k<32; ++k)
- mask[k]=*j->citer++;
- match_result=mask[c>>3]&(1<<(c&7));
- input_consumed=true;
+ if(c>=0 && c<=0xFF)
+ {
+ unsigned char m=*(j->citer+(c>>3));
+ match_result=m&(1<<(c&7));
+ input_consumed=true;
+ j->citer+=32;
+ }
}
else if(instr==MATCH_ANY)
{
result+="\\\\";
else if(static_cast<unsigned char>(*i)<' ' || (escape_8bit && (*i&0x80)))
{
- char buf[4]={'\\', '0'+((*i>>6)&7), '0'+((*i>>3)&7), '0'+(*i&7)};
+ char buf[4]={'\\', '0'+((*i>>6)&3), '0'+((*i>>3)&7), '0'+(*i&7)};
result.append(buf, 4);
}
else