* libtiff/tif_dirread.c: workaround false positive warning of Clang Static

Analyzer about null pointer dereference in TIFFCheckDirOffset().
This commit is contained in:
Even Rouault 2015-12-20 23:18:51 +00:00
parent a292bc2d27
commit 212816f6e4
2 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2015-12-21 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_dirread.c: workaround false positive warning of Clang Static
Analyzer about null pointer dereference in TIFFCheckDirOffset().
2015-12-19 Even Rouault <even.rouault at spatialys.com> 2015-12-19 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_fax3.c: remove dead assignment in Fax3PutEOLgdal(). Found * libtiff/tif_fax3.c: remove dead assignment in Fax3PutEOLgdal(). Found

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.198 2015-11-22 22:37:27 erouault Exp $ */ /* $Id: tif_dirread.c,v 1.199 2015-12-20 23:18:51 erouault Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -3457,12 +3457,12 @@ TIFFReadDirectory(TIFF* tif)
* the fields to check type and tag information, * the fields to check type and tag information,
* and to extract info required to size data * and to extract info required to size data
* structures. A second pass is made afterwards * structures. A second pass is made afterwards
* to read in everthing not taken in the first pass. * to read in everything not taken in the first pass.
* But we must process the Compression tag first * But we must process the Compression tag first
* in order to merge in codec-private tag definitions (otherwise * in order to merge in codec-private tag definitions (otherwise
* we may get complaints about unknown tags). However, the * we may get complaints about unknown tags). However, the
* Compression tag may be dependent on the SamplesPerPixel * Compression tag may be dependent on the SamplesPerPixel
* tag value because older TIFF specs permited Compression * tag value because older TIFF specs permitted Compression
* to be written as a SamplesPerPixel-count tag entry. * to be written as a SamplesPerPixel-count tag entry.
* Thus if we don't first figure out the correct SamplesPerPixel * Thus if we don't first figure out the correct SamplesPerPixel
* tag value then we may end up ignoring the Compression tag * tag value then we may end up ignoring the Compression tag
@ -3663,7 +3663,7 @@ TIFFReadDirectory(TIFF* tif)
* DataType and SampleFormat tags are supposed to be * DataType and SampleFormat tags are supposed to be
* written as one value/sample, but some vendors * written as one value/sample, but some vendors
* incorrectly write one value only -- so we accept * incorrectly write one value only -- so we accept
* that as well (yech). Other vendors write correct * that as well (yuck). Other vendors write correct
* value for NumberOfSamples, but incorrect one for * value for NumberOfSamples, but incorrect one for
* BitsPerSample and friends, and we will read this * BitsPerSample and friends, and we will read this
* too. * too.
@ -3741,7 +3741,7 @@ TIFFReadDirectory(TIFF* tif)
uint32 countrequired; uint32 countrequired;
uint32 incrementpersample; uint32 incrementpersample;
uint16* value=NULL; uint16* value=NULL;
/* It would be dangerous to instanciate those tag values */ /* It would be dangerous to instantiate those tag values */
/* since if td_bitspersample has not yet been read (due to */ /* since if td_bitspersample has not yet been read (due to */
/* unordered tags), it could be read afterwards with a */ /* unordered tags), it could be read afterwards with a */
/* values greater than the default one (1), which may cause */ /* values greater than the default one (1), which may cause */
@ -4394,7 +4394,7 @@ TIFFCheckDirOffset(TIFF* tif, uint64 diroff)
tif->tif_dirnumber++; tif->tif_dirnumber++;
if (tif->tif_dirnumber > tif->tif_dirlistsize) { if (tif->tif_dirlist == NULL || tif->tif_dirnumber > tif->tif_dirlistsize) {
uint64* new_dirlist; uint64* new_dirlist;
/* /*