Skip to content
Snippets Groups Projects
Commit dd83950b authored by Niels Möller's avatar Niels Möller
Browse files

Fix sexp-conv assertion failure, reported by Hanno Böck.

parent 84c96c59
No related branches found
No related tags found
No related merge requests found
2016-02-16 Niels Möller <nisse@lysator.liu.se> 2016-02-16 Niels Möller <nisse@lysator.liu.se>
* tools/input.c (sexp_get_string_length): Process advanced string
syntax only when in advanced mode. Fixes an assertion failure
reported by Hanno Böck, for input where advanced syntax is
improperly wrapped inside transport syntax.
* tools/parse.c (sexp_parse): Fail with an error message for * tools/parse.c (sexp_parse): Fail with an error message for
unexpected ']' characters. Fixes crash reported by Hanno Böck. unexpected ']' characters. Fixes crash reported by Hanno Böck.
Also handle SEXP_DISPLAY (internal error) explicitly, without a Also handle SEXP_DISPLAY (internal error) explicitly, without a
......
...@@ -286,9 +286,7 @@ sexp_get_string_length(struct sexp_input *input, enum sexp_mode mode, ...@@ -286,9 +286,7 @@ sexp_get_string_length(struct sexp_input *input, enum sexp_mode mode,
} }
} }
switch(input->c) if (input->c == ':')
{
case ':':
/* Verbatim */ /* Verbatim */
for (; length; length--) for (; length; length--)
{ {
...@@ -296,12 +294,13 @@ sexp_get_string_length(struct sexp_input *input, enum sexp_mode mode, ...@@ -296,12 +294,13 @@ sexp_get_string_length(struct sexp_input *input, enum sexp_mode mode,
sexp_push_char(input, string); sexp_push_char(input, string);
} }
break; else if (mode != SEXP_ADVANCED)
die("Encountered advanced string in canonical mode.\n");
else
switch(input->c)
{
case '"': case '"':
if (mode != SEXP_ADVANCED)
die("Encountered quoted string in canonical mode.\n");
for (; length; length--) for (; length; length--)
if (sexp_get_quoted_char(input)) if (sexp_get_quoted_char(input))
sexp_push_char(input, string); sexp_push_char(input, string);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment