public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/re2c/, dev-util/re2c/files/
Date: Sun, 19 Apr 2020 19:11:34 +0000 (UTC)	[thread overview]
Message-ID: <1587323485.9f09c916426f9ad39d29f800db74c0ced7c8f252.slyfox@gentoo> (raw)

commit:     9f09c916426f9ad39d29f800db74c0ced7c8f252
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 19 19:11:05 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Apr 19 19:11:25 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f09c916

dev-util/re2c: fix lexer overflow, bug #718350

Direct backport of c4603ba5ce229db ("Fix crash in lexer
refill (reported by Agostino Sarubbo).")

Reported-by: Agostino Sarubbo
Bug: https://bugs.gentoo.org/718350
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 dev-util/re2c/files/re2c-1.3-lexer-overflow.patch | 40 +++++++++++++++++++++++
 dev-util/re2c/re2c-1.3-r1.ebuild                  | 28 ++++++++++++++++
 2 files changed, 68 insertions(+)

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 00000000000..4222ef430c3
--- /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
+

diff --git a/dev-util/re2c/re2c-1.3-r1.ebuild b/dev-util/re2c/re2c-1.3-r1.ebuild
new file mode 100644
index 00000000000..61a196db4c9
--- /dev/null
+++ b/dev-util/re2c/re2c-1.3-r1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="tool for generating C-based recognizers from regular expressions"
+HOMEPAGE="http://re2c.org/"
+SRC_URI="https://github.com/skvadrik/re2c/releases/download/${PV}/${P}.tar.xz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+IUSE="debug"
+
+PATCHES=("${FILESDIR}"/${P}-lexer-overflow.patch)
+
+src_configure() {
+	econf \
+		ac_cv_path_BISON="no" \
+		$(use_enable debug)
+}
+
+src_install() {
+	default
+
+	docompress -x /usr/share/doc/${PF}/examples
+	dodoc -r README.md CHANGELOG examples
+}


             reply	other threads:[~2020-04-19 19:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19 19:11 Sergei Trofimovich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-05-03  9:14 [gentoo-commits] repo/gentoo:master commit in: dev-util/re2c/, dev-util/re2c/files/ Sergei Trofimovich
2018-08-28 19:23 Sergei Trofimovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1587323485.9f09c916426f9ad39d29f800db74c0ced7c8f252.slyfox@gentoo \
    --to=slyfox@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox