[Rpm-maint] [rpm-software-management/rpm] Fix double-free on ternary operator parsing error (#847)

Panu Matilainen notifications at github.com
Thu Sep 19 12:21:24 UTC 2019


That'd work, but then we have inconsistent error messages depending on which branch the error is in:

```
$ ./rpm --eval "%{expr:0 < 1 ? 0 : 4+}"
error: unexpected end of expression: 0 < 1 ? 0 : 4+
$ ./rpm --eval "%{expr:0 < 1 ? 4+ : 0}"
error: syntax error in expression: 0 < 1 ? 4+ : 0
error:                                        ^
```
It also causes a duplicate error at least in the bareword case:
```
$ ./rpm --eval "%{expr:bare}"
error: bare words are no longer supported, please use "...": bare
error:                                                       ^
error: syntax error in expression: bare
error:                            ^

Adding TOK_TERNARY_ALT as a fallthrough case to TOK_EOF in doPrimary() seems to work but didn't actually *think* about it so dunno if there would be other side-effects.


-- 
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/847#issuecomment-533104462
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190919/522d98d9/attachment.html>


More information about the Rpm-maint mailing list