[Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#844)

Panu Matilainen notifications at github.com
Wed Sep 18 11:00:31 UTC 2019


pmatilai commented on this pull request.



> @@ -438,6 +438,10 @@ static Value doMultiplyDivide(ParseState state)
     if (valueIsInteger(v1)) {
       int i1 = v1->data.i, i2 = v2->data.i;
 
+      if ((i2 == 0) && (TOK_DIVIDE)) {

Ugh, yeah:

```
$ ./rpm --eval "%{expr:1*0}"
error: division by zero: 1*0
```


Thanks for spotting, I admit I barely looked at the implementation, this is originally @pavlinamv 's patch in PR #833. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/844#discussion_r325610598
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190918/5b4ff854/attachment.html>


More information about the Rpm-maint mailing list