[Gdal-dev] Methods in the bindings that can easily create a segfault
Ari Jolma
ari.jolma at tkk.fi
Sun Apr 29 04:36:22 EDT 2007
Bindings developers,
I created a small test, which I'd eventually like to include in the Perl
test code, which tests for the strength of the bindings. The test code
calls all known class and object methods with undefined arguments.
Undefined arguments map to NULLs in the Perl bindings. I don't know
about other bindings, but it must be the same at least in some. Below is
a list of the methods that create a segfault (in Windows a dialog box
that says: "Please tell Microsoft about this problem"!!) when called in
this way. Some (two or three) methods in the list don't create a segfaul
but otherwise behave badly, for example ComputeBandStats, when called
with undef (samplestep 0) seems to go into indefinite loop. For some
reason I could not create a valid CoordinateTransformation object.
Dataset.SetDescription fails saying strangely: "This application has
requested the Runtime to terminate it in an unusual way. Please contact
the application's support team for more information."
I've previously added a bunch of tests into the bindings. I wonder if I
should do the same with these, or should I try to create typemaps that
catch NULL parameters.
I consider these serious problems since I believe Perl code should never
cause a segfault. I have an graphical application, where any user can
type in any Perl code. It is just not acceptable that such application
segfaults.
Regards,
Ari
class Geo::GDAL
# GetDataTypeByName (scalar name)
# DecToDMS (scalar double, scalar string, scalar int)
# GetDriverByName (scalar ShortName)
# Open (scalar name, scalar Access=$Geo::GDAL::Const::GA_ReadOnly)
# OpenShared (scalar name, scalar Access=$Geo::GDAL::Const::GA_ReadOnly)
# AutoCreateWarpedVRT (scalar src_ds, scalar src_wkt=undef, scalar
dst_wkt=undef, scalar
ResampleAlg=$Geo::GDAL::Const::GRA_NearestNeighbour, scalar maxerror=0.0)
class Geo::GDAL::Driver
# Delete (scalar name)
class Geo::GDAL::Dataset
class Geo::GDAL::MajorObject
# SetDescription (scalar NewDesc)
class Geo::GDAL::Band
# ComputeBandStats (scalar samplestep=1)
class Geo::OGR
# GetDriverByName (scalar name)
# Open (scalar filename, scalar update=0)
# OpenShared (scalar filename, scalar update=0)
class Geo::OGR::Driver
# TestCapability (scalar cap)
class Geo::OGR::Datasource
# GetDriver ()
# TestCapability (scalar cap)
# ExecuteSQL (scalar statement, scalar geom=undef, scalar dialect="")
class Geo::OGR::Layer
# CreateFeature (scalar feature)
# TestCapability (scalar cap)
# CreateField (scalar field_def, scalar approx_ok=1)
class Geo::OGR::Feature
# Equal (scalar feature)
# SetFrom (scalar other, scalar forgiving=1)
class Geo::OGR::FeatureDefn
# AddFieldDefn (scalar defn)
class Geo::OGR::FieldDefn
class Geo::OGR::Geometry
# Intersection (scalar other)
# Union (scalar other)
# Difference (scalar other)
# SymmetricDifference (scalar other)
# Equal (scalar other)
# Disjoint (scalar other)
# Touches (scalar other)
# Crosses (scalar other)
# Within (scalar other)
# Contains (scalar other)
# Overlaps (scalar other)
# Transform (scalar trans)
class Geo::OSR
# GetWellKnownGeogCSAsWKT (scalar name)
# GetUserInputAsWKT (scalar name)
# GetProjectionMethodParameterList (scalar method)
# GetProjectionMethodParamInfo (scalar method, scalar parameter)
class Geo::OSR::SpatialReference
# IsSame (scalar rhs)
# IsSameGeogCS (scalar rhs)
# GetAttrValue (scalar name, scalar child=0)
# SetAttrValue (scalar name, scalar value)
# GetProjParm (scalar name, scalar default_val=0.0)
# SetNormProjParm (scalar name, scalar val)
# GetNormProjParm (scalar name, scalar default_val=0.0)
# SetWellKnownGeogCS (scalar name)
# SetFromUserInput (scalar name)
# CopyGeogCSFrom (scalar rhs)
# ExportToProj4 ()
# ExportToUSGS ()
class Geo::OSR::CoordinateTransformation
# TransformPoint (scalar x, scalar y, scalar z=0.0)
More information about the Gdal-dev
mailing list