This is an archive of the discontinued LLVM Phabricator instance.

[Support] Fix error handling in DataExtractor::get[US]LEB128
ClosedPublic

Authored by labath on Jun 21 2019, 5:08 AM.

Details

Summary

These functions are documented as not modifying the offset argument if
the extraction fails (just like other DataExtractor functions). However,
while reviewing D63591 we discovered that this is not the case -- if the
function reaches the end of the data buffer, it will just return the
value parsed until that point and set offset to point to the end of the
buffer.

This fixes the functions to act as advertised, and adds a regression
test.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jun 21 2019, 5:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2019, 5:08 AM
Herald added a subscriber: kristina. · View Herald Transcript
dblaikie accepted this revision.Jun 21 2019, 7:28 AM

Awesome - thanks!

This revision is now accepted and ready to land.Jun 21 2019, 7:28 AM
This revision was automatically updated to reflect the committed changes.