Closed fmeum closed 3 years ago
@fmeum Thank you for reporting this, I'll need to have a look.
Ah. So this is broken encoding; the last byte is broken initial byte of 2-byte UTF-8 character, which is why illegal access is made. Should be caught and reported of course (unexpected end of content), will need to see what's the easiest way.
Fixed for 2.12.2; 2 problems:
Slightly worried about (2) in a patch release (and hence no backport for 2.11) since while validation really should be done, no doubt some content exist where "it used to 'work'" (i.e. butchered occasionally mis-encoded character but no one noticed, or some validation removed that garbage later on), but we'll see. Will also file a follow-up issue for 2.13 since as of now validation of UTF-8 characters is inconsistent across code paths -- it shouldn't be, but it is. For 2.13 we can make things more strict more generally.
The following Java snippet crashes with an
ArrayIndexOutOfBoundsException
inCBORParser._finishShortText
:The stack trace with version 2.12.1 is:
This issue appears to be caused by missing bounds checks in the cases of this switch statement.