[Profile] Handle invalid profile data
authorArthur Eubanks <aeubanks@google.com>
Thu, 10 Jun 2021 17:33:47 +0000 (10:33 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 10 Jun 2021 23:10:13 +0000 (16:10 -0700)
commit189428c8fc2465c25efbf4f0bb73e26fecf150ce
tree65a9bc7c2503c75ee01a73d7462eb7a84277b37e
parentcbd0054b9eb17ec48f0702e3828209646c8f5ebd
[Profile] Handle invalid profile data

This mostly follows LLVM's InstrProfReader.cpp error handling.
Previously, attempting to merge corrupted profile data would result in
crashes. See https://crbug.com/1216811#c4.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D104050
compiler-rt/lib/profile/InstrProfiling.h
compiler-rt/lib/profile/InstrProfilingFile.c
compiler-rt/lib/profile/InstrProfilingMerge.c
compiler-rt/test/profile/Linux/corrupted-profile.c [new file with mode: 0644]
compiler-rt/test/profile/Linux/instrprof-merge-vp.c
compiler-rt/test/profile/instrprof-merge.c
compiler-rt/test/profile/instrprof-without-libc.c