Struct corruption in der_decode_sequence_flexi.c #621
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt#621
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Prerequisites
LTC_ARGCHK 'ltc_mp.name != NULL' failure ...). c.f. Ch. "Math Descriptors" of the developer manual.Description
Inspecting
der_decode_sequence_flexi.cat line 152, when parsing an INTEGER we haveThe function
mp_initwrites to anmp_intstructure, butl->datais just avoid*. This trashes the fields followingdatain theltc_asn1_liststruct.Steps to Reproduce
Code inspection.
Version
1.18.2
Additional Information
A fix would be to point
datato an allocatedmp_intbuffer, and then to free it inder_sequence_free.c.mp_init()is not themp_init()you're assuming, butgithub.com/libtom/libtomcrypt@fae62af0ab/src/headers/tomcrypt_private.h (L145)which in turn is MPI provider specific and for LTM declared here:
github.com/libtom/libtomcrypt@fae62af0ab/src/math/ltm_desc.c (L56-L69)This
init()then callsinit_mpi()which allocates the struct you're expecting to be corrupted.github.com/libtom/libtomcrypt@fae62af0ab/src/math/ltm_desc.c (L44-L54)This references the current state of the develop branch and not the latest release, but the mechanism is still the same.
Please re-open if this doesn't fix this for you.
Thanks for the quick response.