summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/wps_parser.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index fc207efb9b..1b845c9f8a 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -870,26 +870,45 @@ static int parse_progressbar(const char *wps_bufptr,
870 if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename, 870 if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename,
871 &x, &y, &width, &height))) 871 &x, &y, &width, &height)))
872 return WPS_ERROR_INVALID_PARAM; 872 return WPS_ERROR_INVALID_PARAM;
873
873 if (LIST_VALUE_PARSED(set, PB_FILENAME)) /* filename */ 874 if (LIST_VALUE_PARSED(set, PB_FILENAME)) /* filename */
874 bmp_names[PROGRESSBAR_BMP+wps_data->progressbar_count] = filename; 875 bmp_names[PROGRESSBAR_BMP+wps_data->progressbar_count] = filename;
876
875 if (LIST_VALUE_PARSED(set, PB_X)) /* x */ 877 if (LIST_VALUE_PARSED(set, PB_X)) /* x */
876 pb->x = x; 878 pb->x = x;
877 else 879 else
878 pb->x = vp->x; 880 pb->x = vp->x;
881
879 if (LIST_VALUE_PARSED(set, PB_WIDTH)) /* width */ 882 if (LIST_VALUE_PARSED(set, PB_WIDTH)) /* width */
883 {
884 /* A zero width causes a divide-by-zero error later, so reject it */
885 if (width == 0)
886 return WPS_ERROR_INVALID_PARAM;
887
880 pb->width = width; 888 pb->width = width;
889 }
881 else 890 else
882 pb->width = vp->width - pb->x; 891 pb->width = vp->width - pb->x;
892
883 if (LIST_VALUE_PARSED(set, PB_HEIGHT)) /* height, default to font height */ 893 if (LIST_VALUE_PARSED(set, PB_HEIGHT)) /* height, default to font height */
894 {
895 /* A zero height makes no sense - reject it */
896 if (height == 0)
897 return WPS_ERROR_INVALID_PARAM;
898
884 pb->height = height; 899 pb->height = height;
900 }
885 else 901 else
886 pb->height = font_height; 902 pb->height = font_height;
903
887 if (LIST_VALUE_PARSED(set, PB_Y)) /* y */ 904 if (LIST_VALUE_PARSED(set, PB_Y)) /* y */
888 pb->y = y; 905 pb->y = y;
889 else 906 else
890 pb->y = line_y_pos + (font_height-pb->height)/2; 907 pb->y = line_y_pos + (font_height-pb->height)/2;
908
891 wps_data->viewports[wps_data->num_viewports].pb = pb; 909 wps_data->viewports[wps_data->num_viewports].pb = pb;
892 wps_data->progressbar_count++; 910 wps_data->progressbar_count++;
911
893 /* Skip the rest of the line */ 912 /* Skip the rest of the line */
894 return skip_end_of_line(wps_bufptr)-1; 913 return skip_end_of_line(wps_bufptr)-1;
895#else 914#else