diff -Nru re2c-1.3/debian/changelog re2c-1.3/debian/changelog --- re2c-1.3/debian/changelog 2020-03-21 12:29:19.000000000 +0000 +++ re2c-1.3/debian/changelog 2020-04-27 12:48:36.000000000 +0000 @@ -1,3 +1,12 @@ +re2c (1.3-1ubuntu0.1) focal-security; urgency=medium + + * SECURITY UPDATE: Heap-based buffer overflow + - debian/patches/CVE-2020-11958.patch: fix calculation + of the shift offset in src/parse/scanner.cc. + - CVE-2020-11958 + + -- Leonidas S. Barbosa Mon, 27 Apr 2020 09:48:36 -0300 + re2c (1.3-1build1) focal; urgency=medium * No-change rebuild for libgcc-s1 package name change. diff -Nru re2c-1.3/debian/control re2c-1.3/debian/control --- re2c-1.3/debian/control 2020-01-08 09:19:04.000000000 +0000 +++ re2c-1.3/debian/control 2020-04-22 13:26:31.000000000 +0000 @@ -1,7 +1,8 @@ Source: re2c Section: devel Priority: optional -Maintainer: JCF Ploemen (jcfp) +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: JCF Ploemen (jcfp) Build-Depends: bison, debhelper-compat (= 12), diff -Nru re2c-1.3/debian/patches/CVE-2020-11958.patch re2c-1.3/debian/patches/CVE-2020-11958.patch --- re2c-1.3/debian/patches/CVE-2020-11958.patch 1970-01-01 00:00:00.000000000 +0000 +++ re2c-1.3/debian/patches/CVE-2020-11958.patch 2020-04-21 14:06:00.000000000 +0000 @@ -0,0 +1,37 @@ +From c4603ba5ce229db83a2a4fb93e6d4b4e3ec3776a Mon Sep 17 00:00:00 2001 +From: Ulya Trofimovich +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(-) + +diff --git a/src/parse/scanner.cc b/src/parse/scanner.cc +index 1d6e9efa..bd651314 100644 +--- 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); diff -Nru re2c-1.3/debian/patches/series re2c-1.3/debian/patches/series --- re2c-1.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ re2c-1.3/debian/patches/series 2020-04-21 14:06:00.000000000 +0000 @@ -0,0 +1 @@ +CVE-2020-11958.patch