]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libsmartcols: reject pathological regex patterns in filter
authorKarel Zak <kzak@redhat.com>
Tue, 23 Jun 2026 14:21:39 +0000 (16:21 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 24 Jun 2026 09:20:15 +0000 (11:20 +0200)
commit622b2f3f5c548f54f36e56e00e7cde3540c5e7f2
tree236e9bdac39f1d5fccc4cb65c919e2d7c37ba0bc
parentd7ed845b966985c37c86e94df5cc6f3cfc98f9d2
libsmartcols: reject pathological regex patterns in filter

Consecutive ERE quantifiers (e.g. a++, a**) and nested group
repetitions (e.g. (a+)+) cause glibc regcomp() to allocate gigabytes
for the NFA, triggering OOM on small inputs.

Reject such patterns in filter_compile_param() before they reach
regcomp(), and limit regex pattern size to SCOLS_FILTER_MAX_REGSZ (256
bytes). Document all filter expression limits in scols-filter(5).

Addresses: https://github.com/util-linux/util-linux/pull/4436
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/scols-filter.5.adoc
libsmartcols/src/filter-param.c
libsmartcols/src/fuzz.c
libsmartcols/src/smartcolsP.h