Opened 14 years ago

Closed 14 years ago

#3271 closed defect (fixed)

GDALColorTable.GetColorEntry() segfault

Reported by: lpinner Owned by: hobu
Priority: normal Milestone: 1.7.0
Component: PythonBindings Version: 1.6.2
Severity: normal Keywords:
Cc:

Description

GDALColorTable.GetColorEntry(n) segfaults when n > GDALColorTable.GetCount()

Obviously, normally I wouldn't attempt to get a colour table entry that doesn't exist, it was just a logic error that I did so, but the method shouldn't segfault, rather return None or raise an exception.

Test script and dataset attached. Occurs on WinXP and Ubuntu 9.04

Attachments (1)

test.zip (983 bytes ) - added by lpinner 14 years ago.

Download all attachments as: .zip

Change History (2)

by lpinner, 14 years ago

Attachment: test.zip added

comment:1 by Even Rouault, 14 years ago

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

This was fixed some time ago in trunk (in r17191)

It now throws an exception

$ python WorkSpace/gdal/test.py
Traceback (most recent call last):
  File "WorkSpace/gdal/test.py", line 11, in <module>
  File "f:\gdal\gdal\swig\python\build\lib.win32-2.6\osgeo\gdal.py", line 937, i
n GetColorEntry
    return _gdal.ColorTable_GetColorEntry(self, *args)
SystemError: error return without exception set

Side note : the last valid index is GDALColorTable.GetCount() - 1.

Note: See TracTickets for help on using tickets.