Add a sanity-check to ensure only in-range subimages are referenced in %xd tags. Plus some tab policing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16774 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1644404fdd
commit
99c0978faa
1 changed files with 5 additions and 1 deletions
|
@ -443,6 +443,10 @@ static int parse_image_display(const char *wps_bufptr,
|
||||||
|
|
||||||
if ((subimage = get_image_id(wps_bufptr[1])) != -1)
|
if ((subimage = get_image_id(wps_bufptr[1])) != -1)
|
||||||
{
|
{
|
||||||
|
/* Sanity check */
|
||||||
|
if (subimage >= wps_data->img[n].num_subimages)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
/* Store sub-image number to display in high bits */
|
/* Store sub-image number to display in high bits */
|
||||||
token->value.i = n | (subimage << 8);
|
token->value.i = n | (subimage << 8);
|
||||||
return 2; /* We have consumed 2 bytes */
|
return 2; /* We have consumed 2 bytes */
|
||||||
|
|
Loading…
Reference in a new issue