From 3f1949a3406f17ffe864008ec6b71ea6044cb258 Mon Sep 17 00:00:00 2001 From: Raphael Quinet Date: Fri, 13 Jul 2007 09:29:58 +0000 Subject: [PATCH] safeguard to avoid crashes while loading corrupt PSD images. Fixes bug 2007-07-13 Raphael Quinet * plug-ins/common/psd-load.c (load_image): safeguard to avoid crashes while loading corrupt PSD images. Fixes bug #327444. svn path=/trunk/; revision=22922 --- ChangeLog | 5 +++++ plug-ins/common/psd-load.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 433ad17c8f..9d9fbe08ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-07-13 Raphaƫl Quinet + + * plug-ins/common/psd-load.c (load_image): safeguard to avoid + crashes while loading corrupt PSD images. Fixes bug #327444. + 2007-07-13 Sven Neumann * plug-ins/common/psd-load.c: use g_printerr() for debug output. diff --git a/plug-ins/common/psd-load.c b/plug-ins/common/psd-load.c index 3bef745ce9..1adf6f6c16 100644 --- a/plug-ins/common/psd-load.c +++ b/plug-ins/common/psd-load.c @@ -2639,7 +2639,9 @@ load_image (const gchar *name) { gimp_progress_update (1.0); - xfread_interlaced (fd, dest, PSDheader.imgdatalen, + xfread_interlaced (fd, dest, MIN (PSDheader.imgdatalen, + step * PSDheader.columns + * PSDheader.rows), "raw image data", step); } else @@ -2647,7 +2649,9 @@ load_image (const gchar *name) gimp_progress_update (1.0); cmykbuf = g_malloc (PSDheader.imgdatalen); - xfread_interlaced (fd, cmykbuf, PSDheader.imgdatalen, + xfread_interlaced (fd, cmykbuf, MIN (PSDheader.imgdatalen, + step * PSDheader.columns + * PSDheader.rows), "raw cmyk image data", step); cmykp2rgb (cmykbuf, dest,