Ticket #1910 (closed defect: duplicate)

Opened 6 years ago

Last modified 6 years ago

python ogr.Open segfaults with None as name

Reported by: timaranz Owned by: mloskot
Priority: normal Milestone: 1.5.0
Component: OGR_SF Version: 1.4.3
Severity: normal Keywords: validate
Cc: hobu, warmerdam

Description

the following 2 lines will cause python to segfault:

import ogr ogr.Open(None)

It should raise a TypeError? instead.

Change History

Changed 6 years ago by timaranz

using the swig interface

Changed 6 years ago by hobu

Are you using the old-gen or the next-gen bindings?

With the next-gen bindings, I get a proper error:

>>> from osgeo import ogr
>>> ogr.UseExceptions()
>>> ogr.Open(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Users/hobu/svn/gdal/swig/python/osgeo/ogr.py", line 3143, in Open
    return _ogr.Open(*args, **kwargs)
RuntimeError: Pointer 'pszName' is NULL in 'OGROpen'.

Changed 6 years ago by warmerdam

  • cc hobu, warmerdam added
  • component changed from default to OGR_SF
  • owner changed from warmerdam to mloskot
  • version changed from unspecified to svn-trunk
  • milestone set to 1.5.0
  • keywords validate added

With the NG trunk bindings I get an induced crash (when not using UseExceptions?):

(gdb) where 5
#0  0x00002aaaab09513d in raise () from /lib/libc.so.6
#1  0x00002aaaab09686e in abort () from /lib/libc.so.6
#2  0x00002aaaabecd96f in CPLErrorV (eErrClass=CE_Fatal, err_no=10, 
    fmt=0x2aaaac28a248 "Pointer '%s' is NULL in '%s'.\n", args=0x7ffffffe9d80)
    at cpl_error.cpp:208
#3  0x00002aaaabecd774 in CPLError (eErrClass=CE_Fatal, err_no=10, 
    fmt=0x2aaaac28a248 "Pointer '%s' is NULL in '%s'.\n") at cpl_error.cpp:133
#4  0x00002aaaac017d28 in OGROpen (pszName=0x0, bUpdate=0, pahDriverList=0x0)
    at ogrsfdriverregistrar.cpp:201
(More stack frames follow...)
(gdb) 

It appears the VALIDATE macro in effect is issuing a fatal, error rather than a CE_Failure error. I don't know why. Turning over to Mateusz to address since he did the validation stuff.

Changed 6 years ago by hobu

Tim,

The CE_Fatal error is thrown because you've built GDAL in debug mode. CE_Failure is thrown when non-debug builds are made. See #1602 for more details.

Howard

Changed 6 years ago by timaranz

  • status changed from new to closed
  • version changed from svn-trunk to 1.4.3
  • resolution set to duplicate

I have finally figured out that all the validation stuff you are talking about is in the trunk and I'm using the 1.4.3 branch which doesn't have any validation.

So AFAICT the bug is fixed in the trunk (duplicate of 1602) and all I need to do is wait for 1.5 to come out.

Note: See TracTickets for help on using tickets.