[gimp/gimp-2-6] file-psp: fix for bogus input data. Fixes bug #639203 (cherry picked from commit 48ec15890e1751dede0



commit 1271b708c2ff00d2dce85ee8541db5ccafb9bbf8
Author: Simon Budig <simon budig de>
Date:   Mon Feb 14 21:46:31 2011 +0100

    file-psp: fix for bogus input data. Fixes bug #639203
    (cherry picked from commit 48ec15890e1751dede061f6d1f469b6508c13439)

 plug-ins/common/file-psp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c
index db12770..e281c41 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -1244,6 +1244,10 @@ read_channel_data (FILE       *f,
             }
           else
             fread (buf, runcount, 1, f);
+
+          /* prevent buffer overflow for bogus data */
+          runcount = MIN (runcount, endq - q);
+
           if (bytespp == 1)
             {
               memmove (q, buf, runcount);



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