forked from len0rd/rockbox
skin_engine: Stricter checking for x, y, width, height for bar tags.
Every theme that doesn't parse anymore now has broken values. I hope it's not too many of them. Change-Id: I6f52e55dc9197d0919f854240723a88f99c0b7da
This commit is contained in:
parent
d243e7e7fe
commit
4e1c690ea7
1 changed files with 17 additions and 4 deletions
|
|
@ -922,30 +922,43 @@ static int parse_progressbar_tag(struct skin_element* element,
|
||||||
|
|
||||||
/* (x, y, width, height, ...) */
|
/* (x, y, width, height, ...) */
|
||||||
if (!isdefault(param))
|
if (!isdefault(param))
|
||||||
|
{
|
||||||
pb->x = param->data.number;
|
pb->x = param->data.number;
|
||||||
|
if (pb->x < 0 || pb->x >= vp->width)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pb->x = 0;
|
pb->x = 0;
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
if (!isdefault(param))
|
if (!isdefault(param))
|
||||||
|
{
|
||||||
pb->y = param->data.number;
|
pb->y = param->data.number;
|
||||||
|
if (pb->y < 0 || pb->y >= vp->height)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pb->y = -1; /* computed at rendering */
|
pb->y = -1; /* computed at rendering */
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
if (!isdefault(param))
|
if (!isdefault(param))
|
||||||
|
{
|
||||||
pb->width = param->data.number;
|
pb->width = param->data.number;
|
||||||
|
if (pb->width <= 0 || (pb->x + pb->width) > vp->width)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pb->width = vp->width - pb->x;
|
pb->width = vp->width - pb->x;
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
if (!isdefault(param))
|
if (!isdefault(param))
|
||||||
{
|
{
|
||||||
/* A zero height makes no sense - reject it */
|
int max;
|
||||||
if (param->data.number == 0)
|
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
|
||||||
|
|
||||||
pb->height = param->data.number;
|
pb->height = param->data.number;
|
||||||
|
/* include y in check only if it was non-default */
|
||||||
|
max = (pb->y > 0) ? pb->y + pb->height : pb->height;
|
||||||
|
if (pb->height <= 0 || max > vp->height)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue