From 57639f37656e5f132a140255579f79230ccdcbee Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 13 Apr 2020 02:50:11 +0200 Subject: [PATCH] Change comment style and use errx instead of err --- src/link/patch.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/link/patch.c b/src/link/patch.c index 5492b5f4..1ddb204b 100644 --- a/src/link/patch.c +++ b/src/link/patch.c @@ -85,14 +85,16 @@ static void pushRPN(int32_t value) static const size_t increase_factor = 2; if (stack.capacity > SIZE_MAX / increase_factor) - err(1, "Overflow in RPN stack resize"); + errx(1, "Overflow in RPN stack resize"); stack.capacity *= increase_factor; stack.buf = realloc(stack.buf, sizeof(*stack.buf) * stack.capacity); - // || !stack.capacity to fix bogus - // zero-size allocation warning from - // scan-build, already caught above + /* + * Static analysis tools complain that the capacity might become + * zero due to overflow, but fail to realize that it's caught by + * the overflow check above. Hence the stringent check below. + */ if (!stack.buf || !stack.capacity) err(1, "Failed to resize RPN stack"); }