gawk/Bug-fix-in-support-regexec.c.patch

31 lines
934 B
Diff
Raw Normal View History

2019-09-30 10:39:14 -04:00
From dc189dc65b6c9b0f521beb4c6105130c6e33a274 Mon Sep 17 00:00:00 2001
From: "Arnold D. Robbins" <arnold@skeeve.com>
Date: Fri, 25 Jan 2019 11:54:54 +0200
Subject: [PATCH 243/289] Bug fix in support/regexec.c.
---
support/ChangeLog | 7 +++++++
support/regexec.c | 6 ++++--
2 files changed, 11 insertions(+), 2 deletions(-)
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;
}
}
--
2.19.1