Repository navigation
der: test invalid UTF8 leading continuation bytes directly - #817
Conversation
Exercise UTF8 continuation bytes directly instead of depending on a later flexi-parser error. Fixes: #561 Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
|
Could a maintainer review this direct DER regression coverage for invalid UTF-8 leading continuation bytes? Please let me know if the cases need changing or if anything else is needed before it can move forward. Thanks. |
|
Following up again on this contribution. If a maintainer could review when convenient, or point me at what to improve, I'd be grateful. Thanks for your time. |
|
the added test is correct, merging now but claim
|
|
Thanks for the review and the merge. Agreed - the Fixes tag was broader than this change. The PR only addresses the first part of #561: the #507 vector passing without the UTF8 fix. The flexi decoder length handling @jamuir described is untouched. Since the merge auto-closed #561, that remaining part no longer has an open issue tracking it. Would you rather reopen #561, or should I open a focused issue for the der_decode_sequence_flexi.c underflow check so it stays tracked? |
Fixes: #561
The existing #507 flexi-parser vector still reports an error when the UTF8 fix is removed, because parsing fails later for an unrelated reason. Add a direct
der_decode_utf8_string()regression so that failure cannot hide acceptance of an invalid leading continuation byte.The test checks all leading bytes from
0x80through0xbf, each followed by another continuation byte, and also checks the originalbf bfUTF8 payload. The DER length and output buffer are sufficient for the old decoder to accept the pair, so the expectedCRYPT_INVALID_PACKETtests the invalid leading byte rather than truncation or output capacity. The existing flexi-parser vector stays unchanged. No production code changes.Validation on Linux with LibTomMath:
-Werrorfull suite: 30 passed, 0 failed, 1 nop.This adds coverage for the UTF8 portion of #507. It does not change the flexi-parser underflow handling discussed in #561.
Checklist
Fixes:tag to the commit message