use-format-literals.patch breaks compilation of glr grammars
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bison (Ubuntu) |
Fix Released
|
Undecided
|
Kees Cook |
Bug Description
Description: Ubuntu precise (development branch)
Release: 12.04
bison:
Installed: 1:2.5.dfsg-2ubuntu1
Candidate: 1:2.5.dfsg-2ubuntu1
Version table:
*** 1:2.5.dfsg-2ubuntu1 0
500 http://
100 /var/lib/
When compiling a C (not C++) GLR grammar, Ubuntu's patched Bison 2.5 generates an invalid file that cannot be compiled because yyerror is called with more arguments than parameters.
For instance, in my grammar the generated .c file contains two calls to yyerror like this one
yyerror (parsed_tree, "%s", yymsg);
which is wrong since yyerror in my grammar only has two parameters: that extra "%s" is amiss.
Note that there are other calls to yyerror in the glr.c skeleton which do not suffer from this problem.
Upstream version 2.5 from GNU site works fine.
Kind regards,
On Thu, Mar 08, 2012 at 08:12:47AM -0000, Roger Ferrer Ibanez wrote:
> When compiling a C (not C++) GLR grammar, Ubuntu's patched Bison 2.5
> generates an invalid file that cannot be compiled because yyerror is
> called with more arguments than parameters.
>
> For instance, in my grammar the generated .c file contains two calls to
> yyerror like this one
>
> yyerror (parsed_tree, "%s", yymsg);
>
> which is wrong since yyerror in my grammar only has two parameters: that
> extra "%s" is amiss.
>
> Note that there are other calls to yyerror in the glr.c skeleton which
> do not suffer from this problem.
>
> Upstream version 2.5 from GNU site works fine.
Yeah, this seems to deviate from the upstream documentation:
http:// www.gnu. org/software/ bison/manual/ html_node/ Error-Reporting .html
It's the implementations of yyerror that need to make sure they don't
use a format literal.
-Kees
--
Kees Cook