[compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizer
authorAlex Shlyapnikov <alekseys@google.com>
Fri, 4 Aug 2017 18:39:36 +0000 (18:39 +0000)
committerAlex Shlyapnikov <alekseys@google.com>
Fri, 4 Aug 2017 18:39:36 +0000 (18:39 +0000)
commitd053135d89370c4a90c3c8027b3b6b9cab1a012e
tree23549a7aa7569912070a6988cbccfe42a3e4dfe7
parent66b9bd6e503bdd87616ab04509ffb3f70220c281
[compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizer

This fixes a bug in the ReadFromSymbolizer method of the
Addr2LineProcess class; if the input is too large, the returned buffer
will be null and will consequently fail the CHECK. The proposed fix is
to simply check if the buffer consists of only a null-terminator and
return if so (in effect skipping that frame). I tested by running one of
the unit tests both before and after my change.

Submitted on behalf of david-y-lam.

Reviewers: eugenis, alekseyshl, kcc

Reviewed By: alekseyshl

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

llvm-svn: 310089
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc