I am using the lemon parser generator in a project
(http://www-csr.bessy.de/control/SoftDist/sequencer/). I updated the
lemon parser template tools/lempar.c to the latest available version and
found two problems, reported by gcc:

./snl.c: In function ‘yy_destructor’:
./snl.c:116:36: warning: unused variable ‘presult’ [-Wunused-variable]
 #define snlParserARG_FETCH  Node **presult  = yypParser->presult
./snl.c:1031:3: note: in expansion of macro ‘snlParserARG_FETCH’
./snl.c: In function ‘snlParser’:
./snl.c:2446:33: warning: comparison of distinct pointer types lacks a
cast [enabled by default]
         while( yypParser->yytos >= &yypParser->yystack

The first is a harmless warning which can be suppressed by using the
snlParserARG_STORE macro in yy_destructor right after
snlParserARG_FETCH, as is done similarly in a number of other functions
in lempar.c.

The second one is *NOT* harmless. The '&' before yypParser->yystack is
indeed wrong and could in corner cases lead to a crash or worse a
security vulnerability.


PS: I am not subscribed, so please add my address to any replies.
"Make it so they have to reboot after every typo." ― Scott Adams

Attachment: signature.asc
Description: OpenPGP digital signature

sqlite-users mailing list

Reply via email to