lib/dfa.c: increase the transitions table max size

This commit is contained in:
Jakub Martisko 2026-01-26 15:53:38 +01:00
parent 4e0d41640f
commit a76ba32cbc
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 2d1641d76c0254e3c95f461d9a0fd080e0f29c3c Mon Sep 17 00:00:00 2001
From: Jakub Martisko <jamartis@redhat.com>
Date: Fri, 23 Jan 2026 13:21:41 +0100
Subject: [PATCH] increase tr count
---
lib/dfa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/dfa.c b/lib/dfa.c
index 0b694e1..d76e9ec 100644
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -354,7 +354,7 @@ typedef struct
/* Maximum for any transition table count. This should be at least 3,
for the initial state setup. */
-enum { MAX_TRCOUNT = 1024 };
+enum { MAX_TRCOUNT = 2048 };
/* A bracket operator.
e.g., [a-c], [[:alpha:]], etc. */
--
2.52.0

View File

@ -3,13 +3,14 @@
Summary: A GNU stream text editor
Name: sed
Version: 4.8
Release: 9%{?dist}
Release: 10%{?dist}
License: GPLv3+
URL: http://sed.sourceforge.net/
Source0: ftp://ftp.gnu.org/pub/gnu/sed/sed-%{version}.tar.xz
Source1: http://sed.sourceforge.net/sedfaq.txt
Patch0: sed-b-flag.patch
Patch1: sed-c-flag.patch
Patch2: sed-regexp-cache-size.patch
BuildRequires: make
BuildRequires: glibc-devel, libselinux-devel, libacl-devel, automake, autoconf, gcc
BuildRequires: perl-Getopt-Long
@ -31,6 +32,7 @@ specified in a script file or from the command line.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
sed -e 's/1729576/EPERM/' \
@ -63,6 +65,16 @@ rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir
%{_mandir}/man1/sed.1*
%changelog
* Fri Jan 23 2026 Jakub Martisko <jamartis@redhat.com> - 4.8-10
- lib/dfa.c: Increase the maximum size of the transitions table
- After changes introduced between sed 4.2 and 4.4, some regexps
started to hit the table size limits. This lead to repeated deletion
and rebuilding of the table, leading to massive performance drops.
While the core issue is still present, this change should at least
help by moving the threshold of the regexp complexity that triggers the
table rebuilds.
- Resolves: RHEL-144026
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 4.8-9
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688