Opened 8 years ago

Closed 8 years ago

#6290 closed defect (fixed)

About GDAL VRT format bug

Reported by: liminlu0314 Owned by: warmerdam
Priority: normal Milestone: 1.11.4
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: Raster VRT CPLScanUIntBig bug
Cc:

Description

I create a VRT file (named Test.vrt) using gdaltest.cpp, but the opened image is wrong. The ImageOffset of the second band is 11659482, while the true value should be 11659458.

In the AddBand function in the vrtdataset.cpp file,the code around line 907 is as below:

/* -------------------------------------------------------------------- */
/*      Collect required information.                                   */
/* -------------------------------------------------------------------- */
        vsi_l_offset nImageOffset = 0;
        if( CSLFetchNameValue(papszOptions, "ImageOffset") != NULL )
            nImageOffset = CPLScanUIntBig(
                CSLFetchNameValue(papszOptions, "ImageOffset"), 20);

In the CPLScanUIntBig function, the size of ImageOffset is set to be 20, which should be changed into 22 to make it right.

Test.vrt and gdaltest.cpp can be found in attatchment. Another attatchment is tm.mdd, which is a Raw file, and can be replaced with any Raw file. debuginfo.png is a debug info.

Attachments (3)

gdaltest.cpp (2.0 KB ) - added by liminlu0314 8 years ago.
c++ code file
Test.vrt (961 bytes ) - added by liminlu0314 8 years ago.
debuginfo.png (16.7 KB ) - added by liminlu0314 8 years ago.

Download all attachments as: .zip

Change History (4)

by liminlu0314, 8 years ago

Attachment: gdaltest.cpp added

c++ code file

by liminlu0314, 8 years ago

Attachment: Test.vrt added

by liminlu0314, 8 years ago

Attachment: debuginfo.png added

comment:1 by Even Rouault, 8 years ago

Milestone: 1.11.4
Resolution: fixed
Status: newclosed

Fixed a bit differently:

trunk r32755, branches/2.0 r32756, branches/1.11 r32757 "VRT raw: don't truncate last figure of ImageOffset if there are left space padding (#6290)"

Note: See TracTickets for help on using tickets.