[gdal-dev] GDAL fails on reading rset via Virtual File

Even Rouault even.rouault at mines-paris.org
Wed Mar 6 01:53:54 PST 2013

Selon Jayesh Chaudhary <aashishcy at gmail.com>:

> Folks,
> I am using GDAL Virtual File mechanism to read data off a stream (something
> like what's shown below)
> VSILFILE* fpTemp = VSIFileFromMemBuffer(szTempFileName, (GByte*)
> s->file_size(), FALSE);
> this->gdal_data_ = (GDALDataset*) GDALOpen(szTempFileName, GA_ReadOnly)
> The code works for most of the file formats of varying size but when I
> tried my reader on the rset NITF files (for example foo.r0), it exited with
> an error below
> Image 29952x21760x1
> File Format: File formats supported by GDAL
> Decoding view (0,0) (+29952,+21760)...ERROR 4:
> VSIFOpenL(/vsimem/tmp_0x1758cd0) failed unexpectedly in jpgdataset.cpp
> ERROR 1: /vsimem/tmp_0x1758cd0, band 1: IReadBlock failed at X offset 75, Y
> offset 2
> ERROR 1: GetBlockRef failed at X block offset 75, Y block offset 2
> vil_convert:
> vil_image_view_base_sptr
> vil_gdal_image_impl::read_data(vil_memory_chunk_sptr, unsigned int,
> unsigned int, unsigned int, unsigned int, unsigned int) [with TPixel =
> unsigned char]: Assertion `err == CE_None' failed.
> Any help is appreciated.

The error message shows an error in the JPEG driver. Are your NITF files JPEG
compressed ? And you're mentionning a RSET NITF, but the filename
/vsimem/tmp_0x1758cd0 doesn't end by r0. Overall it's a bit difficult to
understand what's going wrong without a small self-contained test case and the
associated data files that demonstrate the issue. Looking at the code that deal
with RSET detection, I don't see any obvious reason why in memory files wouldn't

> Thanks.

More information about the gdal-dev mailing list