Opened 11 years ago

Closed 8 years ago

#4616 closed defect (fixed)

GDAL crashing with multiple KernerFilteredSource elements in VRT

Reported by: chaitanya Owned by: chaitanya
Priority: normal Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: VRT KernelFilteredSource
Cc: saad.hessane@…

Description

Reported by Saâd HESSANE on gdal-dev list.

The bug was reproduced by creating a vrt of two adjacent raster files and then modifying it to add a simple 3x3 filter for each source.

Attachments (3)

byte.tif (736 bytes ) - added by Even Rouault 11 years ago.
byte.vrt (2.1 KB ) - added by Even Rouault 11 years ago.
byte2.tif (758 bytes ) - added by Even Rouault 11 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Even Rouault, 11 years ago

Milestone: 1.9.1

A fix :

r24530 /trunk/gdal/frmts/vrt/ (vrtdataset.h vrtfilters.cpp vrtsources.cpp): VRTFilteredSource: fix RasterIO() to take into account source and dest windows (#4616)

r24531 /trunk/gdal/frmts/vrt/vrtsources.cpp: Fix previous commit (#4616)

But I couldn't reproduce any crash however (except an assertion in debug mode with no <Kernel>, that is also fixed). Perhaps you could provide more details on how to reproduce. I'm attaching a small TIF and associated VRT with 2 adjacent KernerFilteredSource that work for me.

by Even Rouault, 11 years ago

Attachment: byte.tif added

comment:2 by hessane, 11 years ago

Hi,

The bug is not reproduced in this way. The goal is to merge multiple dataset (like gdal_merge, but I do a gdalbuildvrt and gdal_translate to include a kernel filter). Your patch fix the crach. But the datasets are not merged when there's a kernel filter (the srcnodata and vrtnodata seem to be ignored). If the vrt declare a KernelFilteredSource but don't set the kernel, there's an error with the gdal_translate (ERROR 1: translate.vrt, band 1: Failed to compute min/max, no valid pixels found in sampling.). When the vrt contain just ComplexSource elements there's no problem. To reproduce the bug :

  • Precondition : have a set of tiled rasters.
  • Build a vrt :
    gdalbuildvrt -resolution highest -srcnodata 0 -vrtnodata 0 -q translate.vrt [the tiled rasters]
    
  • Edit the VRT file to apply a kernel filter : replace the ComplexSource with KernelFilteredSource and add the Kernel element.
  • Do a gdal_translate :
    gdal_translate --config GDAL_CACHEMAX 64 -co "TILED=YES" -co COMPRESS=LZW -co PREDICTOR=2 -q -ot Byte -scale translate.vrt translate.tif
    

comment:3 by Even Rouault, 11 years ago

Hessane,

Your description of the steps to build the VRT exactly matches the byte.vrt I've attached... (except I've used twice the same source raster, but this doesn't change anything). To be clear, I've now added another raster (byte2.tif, which is byte.tif translated to the right) and regenerated the VRT from your indication. But I don't get any crash with an unmodified version, or the fixed version of the VRT driver...

by Even Rouault, 11 years ago

Attachment: byte.vrt added

by Even Rouault, 11 years ago

Attachment: byte2.tif added

comment:4 by Jukka Rahkonen, 8 years ago

Resolution: fixed
Status: newclosed

No crash for me with GDAL 2.0-dev on Windows 7 64-bit with the attached files. Closing as fixed.

Note: See TracTickets for help on using tickets.