HomePhabricator

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

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

Details

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