diff options
author | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2012-08-31 12:24:57 +0100 |
---|---|---|
committer | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2012-08-31 12:24:57 +0100 |
commit | 50188cde05e6f0f039d3d848c3acf9b2a6e21365 (patch) | |
tree | 1a2cf151433e4227ab80e1673ffd5a8aaf717957 /tools/libxl/libxlu_cfg_y.y | |
parent | f185a527caf966e10538d342eb677ccc4875200c (diff) | |
download | xen-50188cde05e6f0f039d3d848c3acf9b2a6e21365.tar.gz xen-50188cde05e6f0f039d3d848c3acf9b2a6e21365.tar.bz2 xen-50188cde05e6f0f039d3d848c3acf9b2a6e21365.zip |
libxl: fix double free on some config parser errors
If libxlu_cfg_y.y encountered a config file error, the code generated
by bison would sometimes _both_ run the %destructor _and_ call
xlu__cfg_set_store for the same XLU_ConfigSetting* semantic value.
The result would be a double free.
This appears to be because of the use of a mid-rule action. There is
some discussion of the problems with destructors and mid-rule action
error handling in "(bison)Mid-Rule Actions". This area is complex and
best avoided.
So fix the bug by abolishing the use of a mid-rule action, which was
in any case not necessary here.
Also while we are there rename the nonterminal rule "setting" to
"assignment", to avoid confusion with the token type "setting", which
had an identically name in a different namespace. This was especially
confusing because the nonterminal "setting" did not have "setting" as
the type of its semantic value! (In fact the nonterminal, now called
"assignment", does not have a value so it does not have a value type.)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxlu_cfg_y.y')
-rw-r--r-- | tools/libxl/libxlu_cfg_y.y | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/libxl/libxlu_cfg_y.y b/tools/libxl/libxlu_cfg_y.y index f0a0559d4b..29aedca783 100644 --- a/tools/libxl/libxlu_cfg_y.y +++ b/tools/libxl/libxlu_cfg_y.y @@ -45,10 +45,10 @@ %% file: /* empty */ - | file setting + | file assignment -setting: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); } - endstmt +assignment: IDENT '=' value endstmt + { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); } | endstmt | error NEWLINE |