Commit 69f60af1 authored by Bastien Nocera's avatar Bastien Nocera

xpm: Fail when XPM file doesn't contain enough data

Fail hard when the XPM file's advertised width or height does not match
the data contained within the file.
parent f7ef901d
......@@ -602,8 +602,14 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
pixtmp = gdk_pixbuf_get_pixels (pixbuf) + ycnt * rowstride;
buffer = (*get_buf) (op_body, handle);
if ((!buffer) || (strlen (buffer) < wbytes))
if ((!buffer) || (strlen (buffer) < wbytes)) {
/* Advertised width doesn't match pixels */
g_set_error_literal (error,
_("Dimensions do not match data"));
goto out;
for (n = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) {
strncpy (pixel_str, &buffer[n], cpp);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment