[sanitizer] Always initialize the regex in the regcomp() interceptor
authorTavian Barnes <tavianator@tavianator.com>
Tue, 15 Mar 2022 21:23:02 +0000 (14:23 -0700)
committerVitaly Buka <vitalybuka@google.com>
Tue, 15 Mar 2022 21:30:57 +0000 (14:30 -0700)
commit9a42715ae887e496df9122b29e86a6d8ebe5d53f
treec660eec25657ad6fc72ca221b77baf76d58d5a94
parent94a11063573b4e1a3405d4a73d9928083115a6c1
[sanitizer] Always initialize the regex in the regcomp() interceptor

When regcomp() fails, the same regex_t* should be passed to regerror()
for potentially better error messages.  But doing that with msan would
report a use-of-uninitialized-value.

Fixes https://github.com/google/sanitizers/issues/1496

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D120591
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/test/sanitizer_common/TestCases/Posix/regex.cpp