Fix DecodeObjectId unknown ext parse#10025
Open
embhorn wants to merge 3 commits intowolfSSL:masterfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect sizing and bounds-checking in OID decoding to prevent out-of-bounds writes and ensure correct arc decoding, and adds a regression test for DecodeObjectId.
Changes:
- Fix
DecodeObjectIdbounds check to require 2 output slots before writing the first two arcs. - Pass element counts (not byte sizes) to
DecodeObjectIdfromDumpOID()and unknown-extension callback path. - Add API test coverage for
DecodeObjectId, including the regression for the first-arc two-write case.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| wolfssl/wolfcrypt/asn.h | Exposes DecodeObjectId to tests and adds an OpenSSL-compat macro alias. |
| wolfcrypt/src/asn.c | Fixes bounds-checking in DecodeObjectId and corrects decOidSz units at call sites. |
| tests/api/test_asn.h | Registers new test_wc_DecodeObjectId test case. |
| tests/api/test_asn.c | Adds DecodeObjectId unit/regression tests. |
Comments suppressed due to low confidence (1)
wolfcrypt/src/asn.c:1
- The regression fix here is specifically about call sites passing the correct unit (element count vs byte size) into
DecodeObjectId. The newly added test exercisesDecodeObjectIddirectly, but doesn’t verify the corrected sizing behavior inDumpOID()(and similarly in the unknown-extension callback path). Consider adding a test that drivesDumpOID()/ASN print (or a known unknown-extension callback invocation) far enough to ensure these call sites decode the full OID rather than failing/truncating due to an incorrectoutSz.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes in
DecodeObjectID:y == 0branch so that it checks*outSz < 2before writing out[0] and out[1]. Previously the checky >= *outSzonly validated one slot but the first-arc code writes two.sizeof(decOid)toMAX_OID_SZin bothDumpOID()and theWC_ASN_UNKNOWN_EXT_CBcode path, soDecodeObjectIdreceives the correct element count (32) rather than the byte count (64).Fixes zd21392
Testing
Added
test_wc_DecodeObjectIdChecklist