This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Replace unreachable with ReportError in debug frame parser.
AbandonedPublic

Authored by JDevlieghere on Oct 2 2017, 8:50 AM.

Details

Summary

The parser should not rely on assertions or unreachables for invalid
input. This patch replaces calls to llvm::unreachable with calls to
ReportError in the debug frame parser.

This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3519
Test case is taken from there.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Oct 2 2017, 8:50 AM
rnk added subscribers: MatzeB, rnk.Oct 2 2017, 9:10 AM

@MatzeB has proposed making report_fatal_error abort, which libfuzzer will re-file as a bug. Converting unreachable to report_fatal_error just kicks the actual error handling down the road.

aprantl edited edge metadata.Oct 2 2017, 9:14 AM

Since we are working towards the goal of making libDebugInfo good enough for LLDB to use, I don't think using report_fatal_error is acceptable on invalid inputs. Could this be made so the parsing returns an optional or expected instead?

JDevlieghere edited edge metadata.Oct 2 2017, 9:28 AM

Thanks guys, I should've given this more thought!

In D38462#885890, @rnk wrote:

@MatzeB has proposed making report_fatal_error abort, which libfuzzer will re-file as a bug. Converting unreachable to report_fatal_error just kicks the actual error handling down the road.

That makes sense.

Since we are working towards the goal of making libDebugInfo good enough for LLDB to use, I don't think using report_fatal_error is acceptable on invalid inputs. Could this be made so the parsing returns an optional or expected instead?

I think this is indeed the desired solution.

JDevlieghere abandoned this revision.Oct 3 2017, 8:49 AM