[gimp] Validate number of colors in XCF colormaps



commit f1a7db80c91c463b69cfb2a05d6a10fc62571eb3
Author: Mukund Sivaraman <muks banu com>
Date:   Sat Oct 16 04:22:11 2010 +0530

    Validate number of colors in XCF colormaps

 app/xcf/xcf-load.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index fd0b5d4..7488b9a 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -398,6 +398,15 @@ xcf_load_image_props (XcfInfo   *info,
 
             info->cp += xcf_read_int32 (info->fp, &n_colors, 1);
 
+            if (n_colors > (GIMP_IMAGE_COLORMAP_SIZE / 3))
+              {
+                gimp_message (info->gimp, G_OBJECT (info->progress),
+                              GIMP_MESSAGE_ERROR,
+                              "Maximum colormap size (%d) exceeded",
+			      GIMP_IMAGE_COLORMAP_SIZE);
+                return FALSE;
+              }
+
             if (info->file_version == 0)
               {
                 gint i;



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