TIFFFetchNormalTag(): avoid (probably false positive) clang-tidy clang-analyzer-core.NullDereference warnings
This commit is contained in:
parent
de144fd228
commit
b68fc85f39
@ -4941,11 +4941,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
err=TIFFReadDirEntryByteArray(tif,dp,&data);
|
||||
if (err==TIFFReadDirEntryErrOk)
|
||||
{
|
||||
uint8* ma;
|
||||
uint32 mb;
|
||||
uint32 mb = 0;
|
||||
int n;
|
||||
ma=data;
|
||||
mb=0;
|
||||
if (data != NULL)
|
||||
{
|
||||
uint8* ma = data;
|
||||
while (mb<(uint32)dp->tdir_count)
|
||||
{
|
||||
if (*ma==0)
|
||||
@ -4953,6 +4953,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
ma++;
|
||||
mb++;
|
||||
}
|
||||
}
|
||||
if (mb+1<(uint32)dp->tdir_count)
|
||||
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" contains null byte in value; value incorrectly truncated during reading due to implementation limitations",fip->field_name);
|
||||
else if (mb+1>(uint32)dp->tdir_count)
|
||||
@ -5201,7 +5202,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
if (err==TIFFReadDirEntryErrOk)
|
||||
{
|
||||
int m;
|
||||
if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
|
||||
if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
|
||||
{
|
||||
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
|
||||
data[dp->tdir_count-1] = '\0';
|
||||
@ -5378,7 +5379,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
if (err==TIFFReadDirEntryErrOk)
|
||||
{
|
||||
int m;
|
||||
if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
|
||||
if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
|
||||
{
|
||||
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
|
||||
data[dp->tdir_count-1] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user