GraphicsMagick: coders/tiff.c: Add sanity check for fractional f...

GraphicsMagick Commits <[email protected]> Sat, 27 Jan 2024 08:14:12 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.6590.1706364864.19238.graphicsmagick-commit@lists.sourceforge.net>
changeset da696c4cff69 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=da696c4cff69
summary: coders/tiff.c: Add sanity check for fractional fixed size array.

diffstat:

 coders/tiff.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (19 lines):

diff -r 3a166b4b9957 -r da696c4cff69 coders/tiff.c
--- a/coders/tiff.c	Sat Jan 27 14:42:01 2024 +0100
+++ b/coders/tiff.c	Sat Jan 27 15:13:41 2024 +0100
@@ -4654,6 +4654,7 @@
                                double *ArrayD;
                                magick_uint32_t i;
                                if(Long2<WriteCount) break;		/* Too small amount of mandatory items. */
+                               if(Value+8*WriteCount>=profile_length-1) break;
                                ArrayD = MagickAllocateResourceLimitedMemory(double *, sizeof(double)*WriteCount);
                                if(ArrayD==NULL) break;
                                for(i=0; i<WriteCount; i++)
@@ -4661,6 +4662,7 @@
                                if(TIFFSetField(tiff, Tag, ArrayD))
                                    FieldCount++;
                                MagickFreeResourceLimitedMemory(ArrayD);
+                               break;
                              }
                            }
                            break;