From 4e7465a3116471efb87a28dec0d99b7cfc08b030 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Wed, 10 Jul 2013 00:44:22 +0000 Subject: [PATCH] initialize TIFFGetField() fetched values in tiffinfo.c --- ChangeLog | 5 +++++ tools/tiffinfo.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6ce1f22..1a6c779c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-07-09 Frank Warmerdam + + * tools/tiffinfo.c: Default various values fetched with + TIFFGetField() to avoid being uninitialized. + 2013-05-02 Tom Lane * tools/tiff2pdf.c: Rewrite JPEG marker parsing in diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c index ae1a5f62..8493439f 100644 --- a/tools/tiffinfo.c +++ b/tools/tiffinfo.c @@ -1,4 +1,4 @@ -/* $Id: tiffinfo.c,v 1.21 2012-06-06 06:05:29 fwarmerdam Exp $ */ +/* $Id: tiffinfo.c,v 1.22 2013-07-10 00:44:22 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -145,7 +145,7 @@ main(int argc, char* argv[]) tiffinfo(tif, order, flags, 1); } else { do { - toff_t offset; + toff_t offset=0; tiffinfo(tif, order, flags, 1); if (TIFFGetField(tif, TIFFTAG_EXIFIFD, @@ -245,9 +245,9 @@ TIFFReadSeparateStripData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif)); if (buf) { - uint32 row, h; + uint32 row, h=0; uint32 rowsperstrip = (uint32)-1; - tsample_t s, samplesperpixel; + tsample_t s, samplesperpixel=0; TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); @@ -296,7 +296,7 @@ TIFFReadContigTileData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(TIFFTileSize(tif)); if (buf) { - uint32 tw, th, w, h; + uint32 tw=0, th=0, w=0, h=0; uint32 row, col; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); @@ -324,9 +324,9 @@ TIFFReadSeparateTileData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(TIFFTileSize(tif)); if (buf) { - uint32 tw, th, w, h; + uint32 tw=0, th=0, w=0, h=0; uint32 row, col; - tsample_t s, samplesperpixel; + tsample_t s, samplesperpixel=0; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); @@ -398,7 +398,7 @@ TIFFReadRawData(TIFF* tif, int bitrev) { tstrip_t nstrips = TIFFNumberOfStrips(tif); const char* what = TIFFIsTiled(tif) ? "Tile" : "Strip"; - uint64* stripbc; + uint64* stripbc=NULL; TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbc); if (nstrips > 0) {