cherry-pick.FILE5_30-41-g393dafa4.work-around-glibc-regex-msan-bug-regexec-returns-0-but-does-initialize-pmatch.patch 532 B

123456789101112131415161718
  1. Subject: Work around glibc/regex/msan bug regexec returns 0 but does initialize pmatch
  2. Origin: FILE5_30-41-g393dafa4
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Fri Apr 7 20:10:24 2017 +0000
  5. Found by oss-fuzz.
  6. --- a/src/funcs.c
  7. +++ b/src/funcs.c
  8. @@ -509,6 +509,8 @@
  9. regmatch_t* pmatch, int eflags)
  10. {
  11. assert(rx->rc == 0);
  12. + /* XXX: force initialization because glibc does not always do this */
  13. + memset(pmatch, 0, nmatch * sizeof(*pmatch));
  14. return regexec(&rx->rx, str, nmatch, pmatch, eflags);
  15. }