Fix modulo by zero
Yet another case caught by scan-build:
src/link/patch.c:188:21: warning: Division by zero
value = popRPN() % value;
~~~~~~~~~^~~~~~~
Just copy over the code from the division case, with a few modifications.
@@ -185,7 +185,13 @@ static int32_t computeRPNExpr(struct Patch const *patch,
break;
case RPN_MOD:
value = popRPN();
+ if (value == 0) {
+ error("%s: Modulo by 0", patch->fileName);
+ popRPN();
+ value = 0;
+ } else {
value = popRPN() % value;
+ }
break;
case RPN_UNSUB:
value = -popRPN();
