[gimp/gimp-2-8] PCX: Stop parsing an invalid file early on.



commit 48f20975c8b52e96257bcb262061aa641cb2842d
Author: Tobias Stoeckmann <tobias stoeckmann org>
Date:   Thu Apr 6 21:42:44 2017 +0200

    PCX: Stop parsing an invalid file early on.
    
    If either width or height is 0, gimp won't process the PCX file.
    Instead, a bunch of error messages are printed.
    
    It's nicer to quit parsing the file early on with a good error message
    which is straight to the point instead.
    
    Signed-off-by: Tobias Stoeckmann <tobias stoeckmann org>
    (cherry picked from commit 20c9b60487f1f6f1562856a328ad39097fa90647)

 plug-ins/common/file-pcx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-pcx.c b/plug-ins/common/file-pcx.c
index 6c7c83f..3c586a5 100644
--- a/plug-ins/common/file-pcx.c
+++ b/plug-ins/common/file-pcx.c
@@ -393,13 +393,13 @@ load_image (const gchar  *filename,
   height       = GUINT16_FROM_LE (pcx_header.y2) - offset_y + 1;
   bytesperline = GUINT16_FROM_LE (pcx_header.bytesperline);
 
-  if ((width < 0) || (width > GIMP_MAX_IMAGE_SIZE))
+  if ((width <= 0) || (width > GIMP_MAX_IMAGE_SIZE))
     {
       g_message (_("Unsupported or invalid image width: %d"), width);
       fclose (fd);
       return -1;
     }
-  if ((height < 0) || (height > GIMP_MAX_IMAGE_SIZE))
+  if ((height <= 0) || (height > GIMP_MAX_IMAGE_SIZE))
     {
       g_message (_("Unsupported or invalid image height: %d"), height);
       fclose (fd);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]