Opened 14 years ago

Closed 14 years ago

#3674 closed defect (fixed)

Failure to read RIK-file

Reported by: TomasR Owned by: chaitanya
Priority: normal Milestone: 1.7.3
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: RIK
Cc:

Description

Using the sample code found in GDALReadDirect.cs GDAL hangs when trying to read from a RIK-file. It loads the file, reads the projection data but halts, with no exception, when image data is to be read. The running stops at the line

band.ReadRaster(0, 0, width, height, r, width, height, 0, 0);

in the SaveBitmapPaletteDirect routine.

The sample binary from GDAL 1.6.1 works as it should, the same from GDAL 1.7.2 do not.

Attached is a small sample file that cause this problem.

Attachments (1)

ab-del.rik (363.1 KB ) - added by TomasR 14 years ago.
A small sample RIK-file

Download all attachments as: .zip

Change History (4)

by TomasR, 14 years ago

Attachment: ab-del.rik added

A small sample RIK-file

comment:1 by Even Rouault, 14 years ago

Component: SWIG (all bindings)GDAL_Raster
Keywords: C# removed
Milestone: 1.7.3
Owner: changed from hobu to chaitanya
Version: unspecified1.7.0

comment:2 by Even Rouault, 14 years ago

Actually I think I've spotted the regression in
http://trac.osgeo.org/gdal/changeset/17398, which was a 1.7 change.

Namely the change from

int i;
for( i = 0; i < LZW_CLEAR; i++ )
        character[i] = i; 

to

GByte j; 
for( j = 0; j < LZW_CLEAR; j++ ) 
        character[j] = j; 

The issue is that LZW_CLEAR = 256, so as j is an unsigned char - restricted 
from 0 to 255 -, the j < LZW_CLEAR condition is always true, thus the 
infinite loop...

This part should be reverted. If you really want to shut up the compiler 
warning character[i] = (GByte)i but in an ideal world, the compiler should be 
clever enough to see that there's no risk of data loss as i does fit in a 
GByte...

comment:3 by chaitanya, 14 years ago

Resolution: fixed
Status: newclosed
Version: 1.7.0svn-trunk

Corrected the RIK driver in trunk (r19985) and 1.7 branch (r19986).

Note: See TracTickets for help on using tickets.