Opened 11 years ago

Closed 11 years ago

#2629 closed defect (fixed)

MrSID SerializeMetadataRec uses bad int sizes on 64-bit compile

Reported by: jburgess777 Owned by: Even Rouault
Priority: normal Milestone: 1.5.4
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: mrsid
Cc:

Description

I ran Valgrind on some software reading a MrSid? format file using GDAL and it reported that MrSIDDataset::SerializeMetadataRec?() was reading memory beyond the size that had been allocated.

==12016== Invalid read of size 8
==12016==    at 0xD6D7054: MrSIDDataset::SerializeMetadataRec(LizardTech::LTIMetadataRecord const*) (mrsiddataset.cpp:962)

...

==12016== Invalid read of size 8                                                                                        
==12016==    at 0xD6D715C: MrSIDDataset::SerializeMetadataRec(LizardTech::LTIMetadataRecord const*) (mrsiddataset.cpp:959)                 

This error occurs because the current code casts the 32 bit data to a 'long *' which is a 64-bit type on x86-64. Changing these to GInt32/GUInt32 fixes it.

Attachments (1)

gdal-mrsid-64bit-fix.patch (856 bytes) - added by jburgess777 11 years ago.
Patch replacing long type with GInt32

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by jburgess777

Attachment: gdal-mrsid-64bit-fix.patch added

Patch replacing long type with GInt32

comment:1 Changed 11 years ago by Even Rouault

Owner: changed from warmerdam to Even Rouault
Status: newassigned

comment:2 Changed 11 years ago by Even Rouault

Component: defaultGDAL_Raster
Keywords: mrsid added
Milestone: 1.5.4
Resolution: fixed
Status: assignedclosed

Thanks. Good catch.

Patch applied in trunk in r15601 and in branches/1.5 in r15602

Note: See TracTickets for help on using tickets.