From 9063f003ce7da10c53ec96bae81af42c2dc765d7 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 19 Apr 2024 09:46:05 -0700 Subject: [PATCH] ascii: Avoid assertion failure on width underflow in text_draw(). Thanks to Zhou Geng for reporting this bug as poc33 in the report here: https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html --- src/output/ascii.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/output/ascii.c b/src/output/ascii.c index d581675fe3..2676792b8d 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -827,6 +827,11 @@ text_draw (struct ascii_driver *a, enum table_halign halign, bool numeric, width -= w; } } + if (width >= SIZE_MAX / 2) + { + /* Width underflow. */ + return; + } if (n == 0) return; -- 2.30.2