GraphicsMagick: coders/tiff.c Fixed TIFF_RATIONAL extraction fro...

GraphicsMagick Commits <[email protected]> Thu, 11 Jan 2024 17:18:26 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.2242.1705015117.5550.graphicsmagick-commit@lists.sourceforge.net>
changeset 1ce20069a419 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=1ce20069a419
summary: coders/tiff.c Fixed TIFF_RATIONAL extraction from EXIF.

diffstat:

 ChangeLog     |  4 ++++
 coders/tiff.c |  8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 50722e7ec434 -r 1ce20069a419 ChangeLog
--- a/ChangeLog	Thu Jan 11 23:42:34 2024 +0100
+++ b/ChangeLog	Fri Jan 12 00:18:01 2024 +0100
@@ -1,3 +1,7 @@
+2024-01-12  Fojtik Jaroslav  <[email protected]>
+
+        coders/tiff.c Fixed TIFF_RATIONAL extraction from EXIF.
+
 2024-01-11  Fojtik Jaroslav  <[email protected]>
 
 	coders/tiff.c Fix for multiple frames. Do not import 
diff -r 50722e7ec434 -r 1ce20069a419 coders/tiff.c
--- a/coders/tiff.c	Thu Jan 11 23:42:34 2024 +0100
+++ b/coders/tiff.c	Fri Jan 12 00:18:01 2024 +0100
@@ -73,7 +73,7 @@
 #  endif /* if defined(COMPRESSION_ZSTD) && defined(HasZSTD) */
 
 #if !defined(EXPERIMENTAL_EXIF_TAGS)
-#  define EXPERIMENTAL_EXIF_TAGS 0
+#  define EXPERIMENTAL_EXIF_TAGS 1 //0
 #endif /* if !defined(EXPERIMENTAL_EXIF_TAGS) */
 
 /*
@@ -4550,7 +4550,11 @@
             case TIFF_RATIONAL:
                          if(FDT==TIFF_RATIONAL && Value!=0)
                          {
-                           double d = Long2 / (double)Value;
+                           double d;
+                           if(Value+8>=profile_length) break;
+                           d = LD_UINT32(profile_data+Value+4);
+                           if(d==0) break;		/* Prevent division by 0. */
+                           d = LD_UINT32(profile_data+Value) / d;
                            if(TIFFSetField(tiff, Tag, d))
                                FieldCount++;
                          }