This is an archive of the discontinued Mercurial Phabricator instance.

dirs: fix out-of-bounds access in Py3
ClosedPublic

Authored by martinvonz on Dec 10 2019, 5:44 PM.

Details

Summary

The hack for mutating Python's variable-length integers that was
ported to py3 in cb3048746dae (dirs: port PyInt code to work on Python
3, 2016-10-08) was reading from ob_digit[1] instead of ob_digit[0] for
some reason. Space for ob_digit[1] would only be allocated for
integers larger than 30 bits, so we ended up writing to unallocated
memory. Also, we would write an integer that's 2^30 times too large,
so we would never free these integers.

Found by AddressSanitizer.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Dec 10 2019, 5:44 PM
spectral accepted this revision.Dec 10 2019, 5:56 PM
martinvonz edited the summary of this revision. (Show Details)Dec 10 2019, 6:11 PM
pulkit accepted this revision.Dec 11 2019, 5:51 AM
This revision is now accepted and ready to land.Dec 11 2019, 5:51 AM
This revision was automatically updated to reflect the committed changes.