doc/mandoc/signed-overflow.patch
$ cat signed-overflow.patch
--- a/roff.c 2021-09-23 19:03:23.000000000 +0100
+++ b/roff.c 2024-05-15 19:25:45.375186003 +0100
@@ -2480,7 +2480,8 @@
p++;
for (*res = 0; isdigit((unsigned char)v[p]); p++)
- *res = 10 * *res + v[p] - '0';
+ *res = (int) ((unsigned int) 10 * *res + v[p] - '0');
+
if (p == *pos + n)
return 0;
@@ -3062,7 +3063,7 @@
}
if ('+' == sign)
- reg->val += val;
+ reg->val = (int) ((unsigned int) val + reg->val);
else if ('-' == sign)
reg->val -= val;
else
