Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marcus Hoffmann
nettle
Commits
dd83950b
Commit
dd83950b
authored
Feb 16, 2016
by
Niels Möller
Browse files
Fix sexp-conv assertion failure, reported by Hanno Böck.
parent
84c96c59
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
dd83950b
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
unexpected ']' characters. Fixes crash reported by Hanno Böck.
Also handle SEXP_DISPLAY (internal error) explicitly, without a
...
...
tools/input.c
View file @
dd83950b
...
...
@@ -286,57 +286,56 @@ sexp_get_string_length(struct sexp_input *input, enum sexp_mode mode,
}
}
switch
(
input
->
c
)
{
case
':'
:
/* Verbatim */
for
(;
length
;
length
--
)
{
sexp_next_char
(
input
);
sexp_push_char
(
input
,
string
);
}
break
;
if
(
input
->
c
==
':'
)
/* Verbatim */
for
(;
length
;
length
--
)
{
sexp_next_char
(
input
);
sexp_push_char
(
input
,
string
);
}
case
'"'
:
if
(
mode
!=
SEXP_ADVANCED
)
die
(
"Encountered quoted string in canonical mode.
\n
"
);
else
if
(
mode
!=
SEXP_ADVANCED
)
die
(
"Encountered advanced string in canonical mode.
\n
"
);
for
(;
length
;
length
--
)
if
(
sexp_get_quoted_char
(
input
))
sexp_push_char
(
input
,
string
);
else
die
(
"Unexpected end of string.
\n
"
);
else
switch
(
input
->
c
)
{
case
'"'
:
for
(;
length
;
length
--
)
if
(
sexp_get_quoted_char
(
input
))
sexp_push_char
(
input
,
string
);
else
die
(
"Unexpected end of string.
\n
"
);
if
(
sexp_get_quoted_char
(
input
))
die
(
"Quoted string longer than expected.
\n
"
);
if
(
sexp_get_quoted_char
(
input
))
die
(
"Quoted string longer than expected.
\n
"
);
break
;
break
;
case
'#'
:
sexp_input_start_coding
(
input
,
&
nettle_base16
,
'#'
);
goto
decode
;
case
'#'
:
sexp_input_start_coding
(
input
,
&
nettle_base16
,
'#'
);
goto
decode
;
case
'|'
:
sexp_input_start_coding
(
input
,
&
nettle_base64
,
'|'
);
case
'|'
:
sexp_input_start_coding
(
input
,
&
nettle_base64
,
'|'
);
decode:
for
(;
length
;
length
--
)
{
sexp_next_char
(
input
);
sexp_push_char
(
input
,
string
);
}
sexp_get_char
(
input
);
if
(
input
->
ctype
!=
SEXP_END_CHAR
)
die
(
"Coded string too long.
\n
"
);
decode:
for
(;
length
;
length
--
)
{
sexp_next_char
(
input
);
sexp_push_char
(
input
,
string
);
}
sexp_get_char
(
input
);
if
(
input
->
ctype
!=
SEXP_END_CHAR
)
die
(
"Coded string too long.
\n
"
);
sexp_input_end_coding
(
input
);
sexp_input_end_coding
(
input
);
break
;
break
;
default:
die
(
"Invalid string.
\n
"
);
}
default:
die
(
"Invalid string.
\n
"
);
}
/* Skip the ending character. */
sexp_get_char
(
input
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment