spvbin-helpers: Properly handle parsing strings with no destination.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 7 Feb 2021 03:52:24 +0000 (19:52 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 7 Feb 2021 03:52:24 +0000 (19:52 -0800)
commit78a43b3fd07c601dea27f0568727f515d39a2153
tree588d121f42a453b1714338c66c15ce1d8b951c0a
parentabe576e80df1aad6a7e21b0e0654e8c1c42deb80
spvbin-helpers: Properly handle parsing strings with no destination.

binary-parser-generator will pass a null pointer to spvbin_parse_string()
or spvbin_parse_bestring() for a string that should be parsed but not
stored.  In such a case, the implementation would dereference a null
pointer.  This fixes the problem.

This is only a theoretical problem because the grammars PSPP uses now
always store the strings that they parse.

Found by cppcheck.
Reported by John Darrington.
src/output/spv/spvbin-helpers.c