From: Ben Pfaff Date: Fri, 19 Apr 2024 16:46:05 +0000 (-0700) Subject: ascii: Avoid assertion failure on width underflow in text_draw(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9063f003ce7da10c53ec96bae81af42c2dc765d7;p=pspp 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 --- 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;