[gdk-pixbuf/gdk-pixbuf-2-38] xpm: Fail when XPM file doesn't contain enough data
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf/gdk-pixbuf-2-38] xpm: Fail when XPM file doesn't contain enough data
- Date: Fri, 1 Mar 2019 11:53:48 +0000 (UTC)
commit 855ff36b933c078967ebbcf6d31799efccf9485d
Author: Bastien Nocera <hadess hadess net>
Date: Fri Mar 1 12:18:33 2019 +0100
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.
gdk-pixbuf/io-xpm.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
index 8a4ceee71..7108f9fbc 100644
--- a/gdk-pixbuf/io-xpm.c
+++ b/gdk-pixbuf/io-xpm.c
@@ -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))
- continue;
+ if ((!buffer) || (strlen (buffer) < wbytes)) {
+ /* Advertised width doesn't match pixels */
+ g_set_error_literal (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Invalid XPM header"));
+ goto out;
+ }
for (n = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) {
strncpy (pixel_str, &buffer[n], cpp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]