Ticket #7743: utf.hpp.patch

File utf.hpp.patch, 902 bytes (added by anonymous, 10 years ago)

Patch that adds the necessary checks

  • utf.hpp

    old new  
    219219                if(BOOST_LOCALE_UNLIKELY(p==e))
    220220                    return incomplete;
    221221                tmp = *p++;
     222                if (!is_trail(tmp))
     223                    return illegal;
    222224                c = (c << 6) | ( tmp & 0x3F);
    223225            case 2:
    224226                if(BOOST_LOCALE_UNLIKELY(p==e))
    225227                    return incomplete;
    226228                tmp = *p++;
     229                if (!is_trail(tmp))
     230                    return illegal;
    227231                c = (c << 6) | ( tmp & 0x3F);
    228232            case 1:
    229233                if(BOOST_LOCALE_UNLIKELY(p==e))
    230234                    return incomplete;
    231235                tmp = *p++;
     236                if (!is_trail(tmp))
     237                    return illegal;
    232238                c = (c << 6) | ( tmp & 0x3F);
    233239            }
    234240