From: Aizal Khan Date: Tue, 7 Jul 2026 10:14:38 +0000 (+0530) Subject: col: guard c_width sign before size_t cast in BS branch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d255a1ea5831a7c72b871a508a5a2cd69f028d6;p=thirdparty%2Futil-linux.git col: guard c_width sign before size_t cast in BS branch Signed-off-by: Aizal Khan --- diff --git a/text-utils/col.c b/text-utils/col.c index 9c0c9acef..9c8f9c225 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -397,7 +397,7 @@ static int handle_not_graphic(struct col_ctl *ctl, struct col_lines *lns) if (lns->cur_col == 0) return 1; /* can't go back further */ if (lns->c) { - if ((size_t) lns->c->c_width <= lns->cur_col) + if (lns->c->c_width >= 0 && (size_t) lns->c->c_width <= lns->cur_col) lns->cur_col -= lns->c->c_width; else lns->cur_col = 0;