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);
|
err=TIFFReadDirEntryByteArray(tif,dp,&data);
|
||||||
if (err==TIFFReadDirEntryErrOk)
|
if (err==TIFFReadDirEntryErrOk)
|
||||||
{
|
{
|
||||||
uint8* ma;
|
uint32 mb = 0;
|
||||||
uint32 mb;
|
|
||||||
int n;
|
int n;
|
||||||
ma=data;
|
if (data != NULL)
|
||||||
mb=0;
|
{
|
||||||
|
uint8* ma = data;
|
||||||
while (mb<(uint32)dp->tdir_count)
|
while (mb<(uint32)dp->tdir_count)
|
||||||
{
|
{
|
||||||
if (*ma==0)
|
if (*ma==0)
|
||||||
@ -4953,6 +4953,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
|||||||
ma++;
|
ma++;
|
||||||
mb++;
|
mb++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mb+1<(uint32)dp->tdir_count)
|
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);
|
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)
|
else if (mb+1>(uint32)dp->tdir_count)
|
||||||
@ -5201,7 +5202,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
|||||||
if (err==TIFFReadDirEntryErrOk)
|
if (err==TIFFReadDirEntryErrOk)
|
||||||
{
|
{
|
||||||
int m;
|
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);
|
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';
|
data[dp->tdir_count-1] = '\0';
|
||||||
@ -5378,7 +5379,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
|||||||
if (err==TIFFReadDirEntryErrOk)
|
if (err==TIFFReadDirEntryErrOk)
|
||||||
{
|
{
|
||||||
int m;
|
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);
|
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';
|
data[dp->tdir_count-1] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user