Opened 17 years ago

Last modified 17 years ago

#1386 closed defect (invalid)

tiff_write_6 test fails with segmentation fault

Reported by: Mateusz Łoskot Owned by: warmerdam
Priority: highest Milestone:
Component: GDAL_Raster Version: 1.4.0
Severity: critical Keywords:
Cc:

Description

Today, I did tried to run gdalautotest package on updated and rebuilt GDAL, but got segmentation fault thrown by tiff_write_6 test case:


--------------------------------------------------------
mloskot:~/dev/gdal/_cvs/autotest/gcore$ ./tiff_write.py
  TEST: tiff_write_1 ... success
  TEST: tiff_write_2 ... success
  TEST: tiff_write_3 ... success
  TEST: tiff_write_4 ... fail (blowup)
Traceback (most recent call last):
  File "../pymod/gdaltest.py", line 167, in run_tests
    result = func()
  File "./tiff_write.py", line 189, in tiff_write_4
    new_ds.GetRasterBand(1).WriteArray( data_red )
  File "/home/mloskot/usr/lib/python2.4/site-packages/gdal.py", line 656, in WriteArray
    return gdalnumeric.BandWriteArray( self, array, xoff, yoff )
  File "/home/mloskot/usr/lib/python2.4/site-packages/gdal_array.py", line 149, in BandWriteArray
    datatype = NumericTypeCodeToGDALTypeCode( array.dtype.type )
AttributeError: dtype
  TEST: tiff_write_5 ... success
  TEST: tiff_write_6 ... Segmentation fault
--------------------------------------------------------


What I did:
-----------
cd gdalautotest
cvs up -Pd 
cd ..

cd gdal
cvs up -Pd 
./configure (see below for configuration summary)
make clean
make
cd swig
make generate
cd python
python setup.py install --prefix=$HOME/usr


--------------------------------------------------------
GDAL is now configured for i686-pc-linux-gnu
 
  Installation directory:    /home/mloskot/usr
  C compiler:                gcc -O2
  C++ compiler:              g++ -O2
 
  LIBTOOL support:           no
 
  LIBZ support:              internal
  GRASS support:             grass57+
  CFITSIO support:           no
  PCRaster support:          internal
  NETCDF support:            no
  LIBPNG support:            internal
  LIBTIFF support:           external
  LIBGEOTIFF support:        internal
  LIBJPEG support:           internal
  LIBGIF support:            internal
  OGDI support:              no
  HDF4 support:              no
  HDF5 support:              no
  KAKADU support:            no
  JASPER support:            yes (GeoJP2=no)
  ECW support:               yes
  MrSID support:             yes
  CURL support (wcs):        yes
  POSTGRESQL support:        yes
  MySQL support:             yes
  XERCES support:            yes
  ODBC support:              yes
  PGEO support:              yes
  OCI support:               yes
  SDE support:               no
  DODS support:              no
  SQLite support:            yes
  DWGdirect support          no
  PANORAMA GIS support:      no
  INFORMIX DataBlade support:no
  GEOS support:              yes
 
  Statically link PROJ.4:    no
 
  Traditional Python:        no
  NG SWIG Bindings:          python
 
  enable OGR building:       yes
--------------------------------------------------------


Here is gdb session with backtrace from tiff_write.py run:


--------------------------------------------------------
mloskot:~/dev/gdal/_cvs/autotest/gcore$ gdb python
GNU gdb 6.4-debian
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
 
(gdb) run ./tiff_write.py
Starting program: /usr/bin/python ./tiff_write.py
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1210451296 (LWP 15243)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
warning: Lowest section in /usr/lib/libicudata.so.34 is .hash at 00000094
  TEST: tiff_write_1 ... success
  TEST: tiff_write_2 ... success
  TEST: tiff_write_3 ... success
  TEST: tiff_write_4 ... fail (blowup)
Traceback (most recent call last):
  File "../pymod/gdaltest.py", line 167, in run_tests
    result = func()
  File "./tiff_write.py", line 189, in tiff_write_4
    new_ds.GetRasterBand(1).WriteArray( data_red )
  File "/home/mloskot/usr/lib/python2.4/site-packages/gdal.py", line 656, in WriteArray
    return gdalnumeric.BandWriteArray( self, array, xoff, yoff )
  File "/home/mloskot/usr/lib/python2.4/site-packages/gdal_array.py", line 149, in BandWriteArray
    datatype = NumericTypeCodeToGDALTypeCode( array.dtype.type )
AttributeError: dtype
  TEST: tiff_write_5 ... success
  TEST: tiff_write_6 ...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210451296 (LWP 15243)]
0xb772bee6 in inflate_blocks_reset (s=0x0, z=0x8275458, c=0x0) at infblock.c:75
75        if (s->mode == BTREE || s->mode == DTREE)
(gdb) bt
#0  0xb772bee6 in inflate_blocks_reset (s=0x0, z=0x8275458, c=0x0) at infblock.c:75
#1  0xb772f4bc in inflateReset (z=0x8275458) at inflate.c:61
#2  0xb5d8afe0 in TIFFSetWriteOffset () from /usr/lib/libtiff.so.4
#3  0xb5d87dce in TIFFFillTile () from /usr/lib/libtiff.so.4
#4  0xb5d87edd in TIFFReadEncodedTile () from /usr/lib/libtiff.so.4
#5  0xb76c8a24 in GTiffRasterBand::IReadBlock (this=0x81f69f8, nBlockXOff=0, nBlockYOff=0, pImage=0x828a508) at geotiff.cpp:477
#6  0xb7806fcf in GDALRasterBand::GetLockedBlockRef (this=0x81f69f8, nXBlockOff=0, nYBlockOff=0, bJustInitialize=0)
    at gdalrasterband.cpp:1158
#7  0xb781949f in GDALRasterBand::IRasterIO (this=0x81f69f8, eRWFlag=GF_Write, nXOff=32, nYOff=0, nXSize=32, nYSize=32,
    pData=0x8280f9c, nBufXSize=32, nBufYSize=32, eBufType=GDT_Byte, nPixelSpace=1, nLineSpace=32) at rasterio.cpp:265
#8  0xb77f40ac in GDALDataset::IRasterIO (this=0x81f68f8, eRWFlag=GF_Write, nXOff=32, nYOff=0, nXSize=32, nYSize=32,
    pData=0x8280f9c, nBufXSize=32, nBufYSize=32, eBufType=GDT_Byte, nBandCount=1, panBandMap=0x825fb20, nPixelSpace=1,
    nLineSpace=32, nBandSpace=1024) at gdaldataset.cpp:1297
#9  0xb77f44a0 in GDALDataset::RasterIO (this=0x81f68f8, eRWFlag=GF_Write, nXOff=32, nYOff=0, nXSize=32, nYSize=32,
    pData=0x8280f9c, nBufXSize=32, nBufYSize=32, eBufType=GDT_Byte, nBandCount=1, panBandMap=0x825fb20, nPixelSpace=1,
    nLineSpace=32, nBandSpace=1024) at gdaldataset.cpp:1490
#10 0xb77f4543 in GDALDatasetRasterIO (hDS=0x81f68f8, eRWFlag=GF_Write, nXOff=32, nYOff=0, nXSize=32, nYSize=32,
    pData=0x8280f9c, nBufXSize=32, nBufYSize=32, eBufType=GDT_Byte, nBandCount=1, panBandMap=0x825fb20, nPixelSpace=0,
    nLineSpace=0, nBandSpace=0) at gdaldataset.cpp:1524
#11 0xb7c8f483 in _wrap_Dataset_WriteRaster (args=0x0, kwargs=0x0) at gdal_wrap.cpp:3184
#12 0x080b63c7 in PyEval_EvalFrame ()
#13 0x080b781f in PyEval_EvalCodeEx ()
#14 0x080b7093 in PyEval_EvalFrame ()
#15 0x080b713b in PyEval_EvalFrame ()
#16 0x080b713b in PyEval_EvalFrame ()
#17 0x080b781f in PyEval_EvalCodeEx ()
#18 0x080b7a65 in PyEval_EvalCode ()
#19 0x080d95cc in PyRun_FileExFlags ()
#20 0x080d986c in PyRun_SimpleFileExFlags ()
#21 0x08055b33 in Py_Main ()
#22 0xb7db4ea2 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#23 0x08054fa1 in _start ()
(gdb)
--------------------------------------------------------


System environment:
Ubuntu 6.06
GCC 4.0.3
Python 2.4
SWIG 1.3.29

Change History (3)

comment:1 by Mateusz Łoskot, 17 years ago

There was a problem with old Numeric package present in my system.
After I removed the Numeric, the tiff_write_4 test does not blowup, but tiff_write_6 still segfaults:

mloskot:~/dev/gdal/_cvs/autotest/gcore$ ./tiff_write.py
  TEST: tiff_write_1 ... success
  TEST: tiff_write_2 ... success
  TEST: tiff_write_3 ... success
  TEST: tiff_write_4 ... success
  TEST: tiff_write_5 ... success
  TEST: tiff_write_6 ... Segmentation fault

comment:2 by warmerdam, 17 years ago

tiff_write_6 tests a fix in libtiff.  It requires a very recent libtiff
(from CVS).  The easiest approach is to use the internal libtiff in GDAL.

comment:3 by Mateusz Łoskot, 17 years ago

(In reply to comment #2)
> tiff_write_6 tests a fix in libtiff.  It requires a very recent libtiff
> (from CVS).  The easiest approach is to use the internal libtiff in GDAL.

Frank, you're perfectly right.

After I configured as:

LIBTIFF support:           external

the all the tiff_write.py tests run with success.
Note: See TracTickets for help on using tickets.