From b6d5707816b4df6223de92af3fcc8139dce9bba4 Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Fri, 3 Jun 2022 12:52:17 -0400 Subject: [PATCH] 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 */