[gimp] plug-ins: fix possible overflow in computation



commit b6d5707816b4df6223de92af3fcc8139dce9bba4
Author: Jacob Boerema <jgboerema gmail com>
Date:   Fri Jun 3 12:52:17 2022 -0400

    plug-ins: fix possible overflow in computation
    
    FLI/FLC width x height is 16-bit unsigned, so theoretically it could
    overflow a 32-bit signed int.
    We fix this by making it a 64-bit signed int.

 plug-ins/file-fli/fli.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/file-fli/fli.c b/plug-ins/file-fli/fli.c
index 88ae239439..85dcc99439 100644
--- a/plug-ins/file-fli/fli.c
+++ b/plug-ins/file-fli/fli.c
@@ -393,7 +393,8 @@ fli_read_frame (FILE          *f,
         }
       if (fli_frame.chunks == 0)
         {
-          memcpy (framebuf, old_framebuf, fli_header->width * fli_header->height);
+          /* Silence a warning: wxh could in theory be more than INT_MAX. */
+          memcpy (framebuf, old_framebuf, (gint64) fli_header->width * fli_header->height);
         }
     }
   else /* unknown, skip */


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