Fix int overflow in mbedtls_asn1_get_int #297
No reviewers
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto!297
Loading…
Reference in a new issue
No description provided.
Delete branch "asn1_get_int-undefined_shift"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix an int overflow in
mbedtls_asn1_get_int()introduced by #75 (so not present in any released version).The signed int overflow in
mbedtls_asn1_get_int()happened for numbers betweenINT_MAX+1andUINT_MAX(typically 0x80000000..0xffffffff). This was undefined behavior which in practice would typically have resulted in an incorrect value, but which may plausibly also have caused the postcondition(*p == initial<*p> + len)to be violated.Also fix up the ASN.1 INTEGER parsing tests a bit.
Credit to OSS-Fuzz (private link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18102). To fix this in OSS-Fuzz, we'll need to update the crypto submodule in mbedtls after merging this PR.
Internal ref: IOTCRYPT-947
That works for me.
@ -230,0 +255,4 @@INTEGER -0x100get_integer:"0202ff00":"-100":0Not super important, but if you wanted decreasing digits, use
0xfedcba9876543210. (swapaandb).CI only failed on atecc608a-K64F jobs which is a known issue that's unrelated to this PR. Ok to merge.