From 2727078f8f2d94cd03344a3c83672b543d726b39 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 7 Feb 2022 01:13:45 +0100 Subject: xplist: Prevent undefined behavior by not trying to negate INT64_MIN --- src/xplist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xplist.c b/src/xplist.c index 9569d07..d8f6458 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -409,7 +409,7 @@ static int num_digits_i(int64_t i) int64_t po10; n=1; if (i < 0) { - i = -i; + i = (i == INT64_MIN) ? INT64_MAX : -i; n++; } po10=10; -- cgit v1.1-32-gdbae