https://github.com/libsdl-org/libtiff/commit/26598448c2c99c5c6a8e6fb32e7d550f7cc9f57d
From 26598448c2c99c5c6a8e6fb32e7d550f7cc9f57d Mon Sep 17 00:00:00 2001
From: Bob Friesenhahn <[EMAIL REDACTED]>
Date: Sun, 30 Aug 2009 16:21:46 +0000
Subject: [PATCH] * contrib/iptcutil/iptcutil.c,
libtiff/tif_getimage.c,libtiff/tif_jpeg.c,libtiff/tif_ojpeg.c,tools/tiffcrop.c,tools/tiffgt.c:
Applied patch from Oden Eriksson to allow building with GCC using the
"-Wformat -Werror=format-security" flags.
---
ChangeLog | 7 +++++++
contrib/iptcutil/iptcutil.c | 6 +++---
libtiff/tif_getimage.c | 8 ++++----
libtiff/tif_jpeg.c | 6 +++---
libtiff/tif_ojpeg.c | 6 +++---
tools/tiffcrop.c | 6 +++---
tools/tiffgt.c | 4 ++--
7 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 606ec5a9..216bc9c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
+
+ * contrib/iptcutil/iptcutil.c,
+ libtiff/tif_getimage.c,libtiff/tif_jpeg.c,libtiff/tif_ojpeg.c,tools/tiffcrop.c,tools/tiffgt.c:
+ Applied patch from Oden Eriksson to allow building with GCC using
+ the "-Wformat -Werror=format-security" flags.
+
2009-08-28 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* libtiff 3.9.1 released.
diff --git a/contrib/iptcutil/iptcutil.c b/contrib/iptcutil/iptcutil.c
index 615b4d68..8dbccde7 100644
--- a/contrib/iptcutil/iptcutil.c
+++ b/contrib/iptcutil/iptcutil.c
@@ -1,4 +1,4 @@
-/* $Id: iptcutil.c,v 1.4 2004-09-21 13:34:39 dron Exp $ */
+/* $Id: iptcutil.c,v 1.4.2.1 2009-08-30 16:21:46 bfriesen Exp $ */
#include "tif_config.h"
@@ -385,7 +385,7 @@ int main(int argc, char *argv[])
if( argc < 2 )
{
- printf(usage);
+ printf("%s\n", usage);
return 1;
}
@@ -444,7 +444,7 @@ int main(int argc, char *argv[])
}
else
{
- printf(usage);
+ printf("%s\n", usage);
return 1;
}
}
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
index 84f744e4..667f3238 100644
--- a/libtiff/tif_getimage.c
+++ b/libtiff/tif_getimage.c
@@ -1,4 +1,4 @@
-/* $Id: tif_getimage.c,v 1.63.2.2 2008-12-21 16:35:19 fwarmerdam Exp $ */
+/* $Id: tif_getimage.c,v 1.63.2.3 2009-08-30 16:21:46 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -481,7 +481,7 @@ TIFFReadRGBAImageOriented(TIFF* tif,
rwidth, img.height);
TIFFRGBAImageEnd(&img);
} else {
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
ok = 0;
}
return (ok);
@@ -2555,7 +2555,7 @@ TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )
TIFFRGBAImageEnd(&img);
} else {
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
ok = 0;
}
@@ -2607,7 +2607,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
if (!TIFFRGBAImageOK(tif, emsg)
|| !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
return( 0 );
}
diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c
index 0e95be66..74b0d3f8 100644
--- a/libtiff/tif_jpeg.c
+++ b/libtiff/tif_jpeg.c
@@ -1,4 +1,4 @@
-/* $Id: tif_jpeg.c,v 1.50.2.3 2008-12-21 20:24:51 fwarmerdam Exp $ */
+/* $Id: tif_jpeg.c,v 1.50.2.4 2009-08-30 16:21:46 bfriesen Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@@ -226,7 +226,7 @@ TIFFjpeg_error_exit(j_common_ptr cinfo)
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message) (cinfo, buffer);
- TIFFErrorExt(sp->tif->tif_clientdata, "JPEGLib", buffer); /* display the error message */
+ TIFFErrorExt(sp->tif->tif_clientdata, "JPEGLib", "%s", buffer); /* display the error message */
jpeg_abort(cinfo); /* clean up libjpeg state */
LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
}
@@ -242,7 +242,7 @@ TIFFjpeg_output_message(j_common_ptr cinfo)
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message) (cinfo, buffer);
- TIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata, "JPEGLib", buffer);
+ TIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata, "JPEGLib", "%s", buffer);
}
/*
diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
index 7328bebb..a95f6e7e 100644
--- a/libtiff/tif_ojpeg.c
+++ b/libtiff/tif_ojpeg.c
@@ -1,4 +1,4 @@
-/* $Id: tif_ojpeg.c,v 1.24.2.2 2009-08-20 22:31:00 bfriesen Exp $ */
+/* $Id: tif_ojpeg.c,v 1.24.2.3 2009-08-30 16:21:46 bfriesen Exp $ */
/* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0
specification is now totally obsolete and deprecated for new applications and
@@ -2359,7 +2359,7 @@ OJPEGLibjpegJpegErrorMgrOutputMessage(jpeg_common_struct* cinfo)
{
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo,buffer);
- TIFFWarningExt(((TIFF*)(cinfo->client_data))->tif_clientdata,"LibJpeg",buffer);
+ TIFFWarningExt(((TIFF*)(cinfo->client_data))->tif_clientdata,"LibJpeg", "%s", buffer);
}
static void
@@ -2367,7 +2367,7 @@ OJPEGLibjpegJpegErrorMgrErrorExit(jpeg_common_struct* cinfo)
{
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo,buffer);
- TIFFErrorExt(((TIFF*)(cinfo->client_data))->tif_clientdata,"LibJpeg",buffer);
+ TIFFErrorExt(((TIFF*)(cinfo->client_data))->tif_clientdata,"LibJpeg", "%s", buffer);
jpeg_encap_unwind((TIFF*)(cinfo->client_data));
}
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index aeccc927..3d2c389f 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -1,4 +1,4 @@
-/* $Id: tiffcrop.c,v 1.3.2.6 2009-08-20 22:31:00 bfriesen Exp $ */
+/* $Id: tiffcrop.c,v 1.3.2.7 2009-08-30 16:21:46 bfriesen Exp $ */
/* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of
* the image data through additional options listed below
@@ -1976,7 +1976,7 @@ main(int argc, char* argv[])
(dump.format == DUMP_TEXT) ? "txt" : "raw");
if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL)
{
- TIFFError ("Unable to open dump file %s for writing", temp_filename);
+ TIFFError ("Unable to open dump file %s for writing", "%s", temp_filename);
exit (-1);
}
dump_info(dump.infile, dump.format, "Reading image","%d from %s",
@@ -1992,7 +1992,7 @@ main(int argc, char* argv[])
(dump.format == DUMP_TEXT) ? "txt" : "raw");
if ((dump.outfile = fopen(temp_filename, dump.mode)) == NULL)
{
- TIFFError ("Unable to open dump file %s for writing", temp_filename);
+ TIFFError ("Unable to open dump file %s for writing", "%s", temp_filename);
exit (-1);
}
dump_info(dump.outfile, dump.format, "Writing image","%d from %s",
diff --git a/tools/tiffgt.c b/tools/tiffgt.c
index a62ed2db..eb4786f6 100644
--- a/tools/tiffgt.c
+++ b/tools/tiffgt.c
@@ -1,4 +1,4 @@
-/* $Id: tiffgt.c,v 1.7 2006-03-23 14:54:02 dron Exp $ */
+/* $Id: tiffgt.c,v 1.7.2.1 2009-08-30 16:21:46 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -204,7 +204,7 @@ initImage(void)
if (photo != (uint16) -1)
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photo);
if (!TIFFRGBAImageBegin(&img, tif, stoponerr, title)) {
- TIFFError(filelist[fileindex], title);
+ TIFFError(filelist[fileindex], "%s", title);
TIFFClose(tif);
tif = NULL;
return -1;