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

Resolves: RHEL-17133
This commit is contained in:
Jakub Martisko 2026-01-23 13:38:36 +01:00
parent aaa7fc51f5
commit d4dcd1bc29
2 changed files with 38 additions and 0 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

@ -12,6 +12,8 @@ Source1: http://sed.sourceforge.net/sedfaq.txt
Patch0: sed-4.2.2-binary_copy_args.patch
Patch2: sed-fuse.patch
Patch3: sed-selinux-testsuite.patch
Patch4: sed-regexp-cache-size.patch
BuildRequires: glibc-devel, libselinux-devel, libacl-devel, automake, autoconf
BuildRequires: perl-Getopt-Long
Requires(post): /sbin/install-info
@ -34,6 +36,7 @@ specified in a script file or from the command line.
%patch0 -p1 -b .copy
%patch2 -p1
%patch3 -p2
%patch4 -p1
%build
%configure --without-included-regex
@ -73,6 +76,16 @@ fi
%{_mandir}/man*/*
%changelog
* Fri Jan 23 2026 Jakub Martisko <jamartis@redhat.com> - 4.5-6
- 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-17133
* Tue Oct 05 2021 Jakub Martisko <jamartis@redhat.com> - 4.5-5
- Minor cleanup - remove unused patch from the spec file too (related to 4.5-3)
- Resolves: rhbz#1869253