Opened 17 years ago

Last modified 17 years ago

#1602 closed defect

The validity of user supplied parameters is not checked in the API — at Initial Version

Reported by: Ari Jolma Owned by: warmerdam
Priority: highest Milestone: 1.5.0
Component: default Version: unspecified
Severity: major Keywords: refactoring safety
Cc: warmerdam

Description

Many methods in the GDAL and OGR, which are also defined in the C-API, do not check if the supplied parameter is valid. Invalid parameter values, notably NULLs given where a string or a handle is expected, lead to a segfault. Since the C-API is open to many scripting languages through the SWIG, and given the way scripting languages are used, it is a common case that invalid values end up to the GDAL and OGR core.

Some checks have been introduced to the SWIG interface (for example in ogr.i in OGRLayerShadow *CreateLayer) but it is probably better to implement all these checks in the C-API. Following is a (not necessarily a comprehensive) list of classes and methods which have this defect: (the list should be self-explanatory, it follows the SWIG API)

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::MajorObject # SetDescription (scalar NewDesc) class Geo::GDAL::Band # ComputeBandStats (scalar samplestep=1) (if samplestep == 0, the method gets into an eternal loop?) 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 # 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::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)

Change History (0)

Note: See TracTickets for help on using tickets.