HomePhabricator

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

Authored by labath on Mon, Jun 24, 2:11 AM.

Description

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

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.

Reviewers: dblaikie, probinson, bkramer

Subscribers: kristina, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63645

llvm-svn: 364169

Details

Committed
labathMon, Jun 24, 2:11 AM
Differential Revision
D63645: [Support] Fix error handling in DataExtractor::get[US]LEB128
Parents
rGa94c18fc2006: Follow up of rL363913. NFC.
Branches
Unknown
Tags
Unknown