[Gdal-dev] Testing arguments in the swig-bindings

Frank Warmerdam warmerdam at pobox.com
Tue Aug 28 10:29:29 EDT 2007


Ari Jolma wrote:
> This relates to ticket #1602 (http://trac.osgeo.org/gdal/ticket/1602), 
> which I opened a while ago since I'm concerned about programs (including 
> interactive programs) failing with segfault since undefined variables 
> are mapped to NULLs in the swig bindings and GDAL is not always prepared 
> to receive NULLs as arguments. This happens at least in the case of Perl.
> 
> Mateusz has implemented object pointer checks into the C API, which 
> takes care of many of these problems but not all and it is perhaps not 
> sensible to make the C API bullet-proof in this sense.
> 
> I'd like to continue this work, and add more checks, probably into the 
> swig bindings. I'd like to know, if other swig binding developers have 
> ideas or concerns regarding this?

Ari,

Can you provide more information on the kinds of input validation you
would like to see added, and the rationale?  I think one of the examples
you gave was passing in NULL strings where they are required.

Some kind of argument checking, for instance passing in an unsupported
resampling type when building overviews, would seem to be best checked
in the appropriate C++ methods and a runtime error reported.

NULL objects seemed to me to be best checked for the C wrappers which
we have done.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list