From 024b039f1f6181f03b86a35ead02cdc88332f2fb Mon Sep 17 00:00:00 2001 From: Jon Sneyers Date: Thu, 22 Sep 2016 14:48:49 +0200 Subject: [PATCH] FLIF 0.2 release --- src/flif-dec.cpp | 6 +++--- src/flif.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/flif-dec.cpp b/src/flif-dec.cpp index ba5e0594..9726efc4 100644 --- a/src/flif-dec.cpp +++ b/src/flif-dec.cpp @@ -1001,10 +1001,10 @@ bool flif_decode(IO& io, Images &images, int quality, int scale, uint32_t (*call int scale_shift = ilog2(scale); if (scale_shift>0) v_printf(3,"Decoding downscaled image at scale 1:%i (%ix%i -> %ix%i)\n", scale, width, height, ((width-1)/scale)+1, ((height-1)/scale)+1); - int bytesperpixel = (maxmax > 255 ? 2 : 1) * (numPlanes + (numPlanes > 1 ? 2 : 0)); - uint64_t estimated_buffer_size = (((width-1)/scale)+1) * (((height-1)/scale)+1) * numFrames * numPlanes * bytesperpixel; + uint64_t bytesperpixel = (maxmax > 255 ? 2 : 1) * (numPlanes + (numPlanes > 1 ? 2 : 0)); + uint64_t estimated_buffer_size = (uint64_t)(((width-1)/scale)+1) * (uint64_t)(((height-1)/scale)+1) * (uint64_t)numFrames * (uint64_t)numPlanes * bytesperpixel; if (estimated_buffer_size > MAX_IMAGE_BUFFER_SIZE) { - e_printf("This is going to take too much memory. Aborting.\nCompile with a higher MAX_IMAGE_BUFFER_SIZE if you really want to do this.\n"); return false; + e_printf("This is going to take too much memory (%llu > %llu). Aborting.\nCompile with a higher MAX_IMAGE_BUFFER_SIZE if you really want to do this.\n",estimated_buffer_size, MAX_IMAGE_BUFFER_SIZE); return false; } for (int i=0; i