diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2019-01-25 11:55:32 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2019-01-25 11:55:32 +0200 |
commit | 48f4822b0602c44aacd418f36ff35645e8379b8e (patch) | |
tree | 57a674bcf39439b264ec3417003732fc6f53c0d5 /support | |
parent | 5766636f7bb7eb6d8fa9fd1b097ca74329062173 (diff) | |
parent | dc189dc65b6c9b0f521beb4c6105130c6e33a274 (diff) | |
download | egawk-48f4822b0602c44aacd418f36ff35645e8379b8e.tar.gz egawk-48f4822b0602c44aacd418f36ff35645e8379b8e.tar.bz2 egawk-48f4822b0602c44aacd418f36ff35645e8379b8e.zip |
Merge branch 'gawk-4.2-stable'
Diffstat (limited to 'support')
-rw-r--r-- | support/ChangeLog | 7 | ||||
-rw-r--r-- | support/regexec.c | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 9e0ffe71..0295d9c1 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,10 @@ +2019-01-21 Paul Eggert <eggert@cs.ucla.edu> + + regex: fix read overrun + Problem found by AddressSanitizer, reported by Hongxu Chen in: + https://debbugs.gnu.org/cgi/34140 + * regexec.c (proceed_next_node): Do not read past end of input buffer. + 2019-01-09 John E. Malmberg <wb8tyw@qsl.net> * cdefs.h, xalloc.h: For non GCC, have diff --git a/support/regexec.c b/support/regexec.c index ecb430d3..ff6ab120 100644 --- a/support/regexec.c +++ b/support/regexec.c @@ -1293,8 +1293,10 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); - if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, - naccepted) != 0) + if (mctx->input.valid_len - *pidx < naccepted + || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, + naccepted) + != 0)) return -1; } } |