• T
    Fix insufficiently-paranoid GB18030 encoding verifier. · a868931f
    Tom Lane 提交于
    The previous coding effectively only verified that the second byte of a
    multibyte character was in the expected range; moreover, it wasn't careful
    to make sure that the second byte even exists in the buffer before touching
    it.  The latter seems unlikely to cause any real problems in the field
    (in particular, it could never be a problem with null-terminated input),
    but it's still a bug.
    
    Since GB18030 is not a supported backend encoding, the only thing we'd
    really be doing with GB18030 text is converting it to UTF8 in LocalToUtf,
    which would fail anyway on any invalid character for lack of a match in
    its lookup table.  So the only user-visible consequence of this change
    should be that you'll get "invalid byte sequence for encoding" rather than
    "character has no equivalent" for malformed GB18030 input.  However,
    impending changes to the GB18030 conversion code will require these tighter
    up-front checks to avoid producing bogus results.
    a868931f
wchar.c 44.1 KB