[gdal-dev] Re: Bug(?): RIK-maps with Gdal 1.7.2 do not work

Even Rouault even.rouault at mines-paris.org
Tue Jul 6 13:46:24 EDT 2010


Chaitanya,

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... 

Best regards,

Even

Le Tuesday 06 July 2010 19:18:56 Tomas R, vous avez écrit :
>   The reason for the out of memory exception was because the RIK-map I
> tested with i wasfar to big to be read into a bitmap. I have now created
> a smaller sample.
>
> With the small RIK-fil I can reproduce the problem with the precompiled
> binaries from dyndns so problem is not only on my part. Using the small
> map (1000x750 pixels) the demo app from Gdal 1.6.1 works as it should.
> 1.7.2 hangs with no exception given.
>
> See ticket http://trac.osgeo.org/gdal/ticket/3674
>
> The post you answered  I tried to delete and somewhat succeeded... I
> happened to compile the wrong file. When I thought I was compiling the
> GDALReadDirect.cs I instead compiled the GDALRead.cs.
>
> Yours
> Tomas
>
> Chaitanya kumar CH skrev 2010-07-06 18:24:
> > Tomas,
> >
> > I don't see any changes that could lead to infinite loops or memory
> > leaks recently.
> > If you can provide a sample dataset that gives this error please raise
> > a ticket at http://trac.osgeo.org/gdal/newticket
> >
> > On Tue, Jul 6, 2010 at 6:43 PM, Tomas R <monshi at home.se
> > <mailto:monshi at home.se>> wrote:
> >
> >      I add - perhaps a problem with my comilation of Gdal.  Note when
> >     I compile the GdalReadDirect.cs as it is and run it the result
> >     differs from the result of the GdalReadDirect.exe found in
> >     Swig\Csharp.
> >     The latter gives the Raster dataset Paramets and runs until an Out
> >     of memory Exception. Mine hangs and I have to abort it.
> >
> >     What have I done wrong this time?
> >
> >     Will try to recompile gdal and see if anything changes.
> >
> >     Tomas R skrev 2010-07-06 14:16:
> >
> >          I have a problem with RIK-maps and Gdal 1.7.2.
> >
> >         If I use Gdal 1.6.1 I have no problem reading the map but
> >         doing the same with Gdal 1.7.2 my whole plugin/software hangs.
> >
> >         I have identified that Gdal stops at the line
> >
> >          band.ReadRaster(x, y, width, height, r, width, height, 0, 0);
> >
> >         where x, y, width and height are controlled to be within the
> >         image to load.
> >         This line taken from the routine
> >          private void SaveBitmapPaletteDirect(...)
> >         from the C# samples. I have adapted it to load only a portion
> >         of the map into a bitmap.
> >
> >         I have compiled Gdal myself, perhaps a problem with the
> >         compilation? Do I miss the RIK-driver or something? Or is
> >         there an error in Gdal?  Or perhaps in the file(s)?
> >         I have no problem opening and getting the properties of the
> >         file, i.e. coordinate system and alike. It is when I try to
> >         read the file that Gdal hangs.
> >
> >         I get no Exception, it just hangs and eats CPU-time.
> >
> >         I  compile the C# sample GDALReadDirect.cs from Gdal 1.7.2 and
> >         adapt it to read a portion of a big RIK file (500x500 pixels)
> >         and it stops at the same point in code. Error in the driver
> >         for RIK perhaps? or error in the sample code?
> >
> >         Yours
> >         Tomas
> >
> >
> >     _______________________________________________
> >     gdal-dev mailing list
> >     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
> >     http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> >
> >
> >
> > --
> > Best regards,
> > Chaitanya kumar CH.
> > /tʃaɪθənjə/ /kʊmɑr/
> > +91-9494447584
> > 17.2416N 80.1426E
> >
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list