2009.08.30 16:41 "Re: [Tiff] string format errors", by Oden Eriksson

2009.08.30 16:41 "Re: [Tiff] string format errors", by Oden Eriksson

söndagen den 30 augusti 2009 18.25.23 skrev Bob Friesenhahn:
> On Sun, 30 Aug 2009, Oden Eriksson wrote:
> > Attached is a patch to fix build with gcc when using the "-Wformat -
> > Werror=format-security" flags. It applies to 3.9.1
>
> Those warnings were bothering me as well. I have applied your fixes
> to the branch-3-9 CVS branch. Are you able to provide a similar patch
> for tiff-4.0.0beta4?

Most issues seems fixed in 4.0.0beta4, a patch is applied.

--
Regards // Oden Eriksson

diff -Naurp tiff-4.0.0beta4/tools/tiffcrop.c tiff-4.0.0beta4.oden/tools/tiffcrop.c

--- tiff-4.0.0beta4/tools/tiffcrop.c    2009-02-14 20:06:15.000000000 +0100

+++ tiff-4.0.0beta4.oden/tools/tiffcrop.c       2009-08-30 18:38:06.000000000 +0200

@@ -1981,7 +1981,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",
@@ -1997,7 +1997,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 -Naurp tiff-4.0.0beta4/tools/tiffgt.c tiff-4.0.0beta4.oden/tools/tiffgt.c

--- tiff-4.0.0beta4/tools/tiffgt.c      2006-03-24 15:59:55.000000000 +0100
+++ tiff-4.0.0beta4.oden/tools/tiffgt.c 2009-08-30 18:38:06.000000000 +0200

@@ -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;