summaryrefslogtreecommitdiff
path: root/dev-util/re2c/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-04-30 12:37:28 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-04-30 12:37:28 +0100
commitbe9d77d3ac6af8f4ead98d89706f356b65578c93 (patch)
treef82923fbca262493e83dd1382e561a2fae24cc46 /dev-util/re2c/files
parent7ec0832ab5dafbf70de83e0c2f3ee740416a0950 (diff)
parent6faaec2b812feecd9c8751b8a19004da4a17ea5b (diff)
Merge branch 'edge' into next
Diffstat (limited to 'dev-util/re2c/files')
-rw-r--r--dev-util/re2c/files/re2c-1.3-lexer-overflow.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/dev-util/re2c/files/re2c-1.3-lexer-overflow.patch b/dev-util/re2c/files/re2c-1.3-lexer-overflow.patch
new file mode 100644
index 000000000000..4222ef430c32
--- /dev/null
+++ b/dev-util/re2c/files/re2c-1.3-lexer-overflow.patch
@@ -0,0 +1,40 @@
+https://bugs.gentoo.org/718350
+
+From c4603ba5ce229db83a2a4fb93e6d4b4e3ec3776a Mon Sep 17 00:00:00 2001
+From: Ulya Trofimovich <skvadrik@gmail.com>
+Date: Fri, 17 Apr 2020 22:47:14 +0100
+Subject: [PATCH] Fix crash in lexer refill (reported by Agostino Sarubbo).
+
+The crash happened in a rare case of a very long lexeme that doen't fit
+into the buffer, forcing buffer reallocation.
+
+The crash was caused by an incorrect calculation of the shift offset
+(it was smaller than necessary). As a consequence, the data from buffer
+start and up to the beginning of the current lexeme was not discarded
+(as it should have been), resulting in less free space for new data than
+expected.
+---
+ src/parse/scanner.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/src/parse/scanner.cc
++++ b/src/parse/scanner.cc
+@@ -155,13 +155,14 @@ bool Scanner::fill(size_t need)
+ if (!buf) fatal("out of memory");
+
+ memmove(buf, tok, copy);
+- shift_ptrs_and_fpos(buf - bot);
++ shift_ptrs_and_fpos(buf - tok);
+ delete [] bot;
+ bot = buf;
+
+ free = BSIZE - copy;
+ }
+
++ DASSERT(lim + free <= bot + BSIZE);
+ if (!read(free)) {
+ eof = lim;
+ memset(lim, 0, YYMAXFILL);
+--
+2.26.1
+