forked from len0rd/rockbox
Add detection for a previously ignored error case: a conditional token is present but no conditional start token (e.g. "%?C%al|>"). This would cause an inifnite loop in the displaying code. Thanks to markun for making the mistake and reporting it ;)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15598 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
87e5b1193c
commit
8537cbf091
1 changed files with 11 additions and 1 deletions
|
|
@ -961,6 +961,11 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
|
|||
data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_END;
|
||||
if (lastcond[level])
|
||||
data->tokens[lastcond[level]].value.i = data->num_tokens;
|
||||
else
|
||||
{
|
||||
fail = PARSE_FAIL_COND_SYNTAX_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
lastcond[level] = 0;
|
||||
data->num_tokens++;
|
||||
|
|
@ -979,6 +984,11 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
|
|||
data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_OPTION;
|
||||
if (lastcond[level])
|
||||
data->tokens[lastcond[level]].value.i = data->num_tokens;
|
||||
else
|
||||
{
|
||||
fail = PARSE_FAIL_COND_SYNTAX_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
lastcond[level] = data->num_tokens;
|
||||
numoptions[level]++;
|
||||
|
|
@ -1085,7 +1095,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr)
|
|||
}
|
||||
}
|
||||
|
||||
if (level >= 0) /* there are unclosed conditionals */
|
||||
if (!fail && level >= 0) /* there are unclosed conditionals */
|
||||
fail = PARSE_FAIL_UNCLOSED_COND;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue