Skip to content

Commit 8963210

Browse files
authored
Merge pull request OSGeo#13052 from dbaston/suggested-warp-output-null-input
SWIG: Guard against null input to SuggestedWarpOutput
1 parent a53d94d commit 8963210

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

autotest/alg/warp.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,11 @@ def test_warp_41():
12931293
assert src_gt[i] == pytest.approx(vrt_gt[i], abs=1e-5)
12941294

12951295

1296+
def test_warp_suggestedwarp_output_invalid_input():
1297+
with pytest.raises(Exception):
1298+
gdal.SuggestedWarpOutput(None, {"DST_SRS": "EPSG:4326"})
1299+
1300+
12961301
###############################################################################
12971302

12981303
# Maximum

swig/include/Operations.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ struct SuggestedWarpOutputRes
913913
#else
914914
%newobject SuggestedWarpOutput;
915915
#endif
916+
%apply Pointer NONNULL {GDALDatasetShadow *src};
916917
%inline %{
917918
#ifdef SWIGPYTHON
918919
SuggestedWarpOutputRes* SuggestedWarpOutputFromOptions( GDALDatasetShadow *src,
@@ -941,6 +942,7 @@ struct SuggestedWarpOutputRes
941942
return res;
942943
}
943944
%}
945+
%clear GDALDatasetShadow *src;
944946

945947
#ifdef SWIGPYTHON
946948

0 commit comments

Comments
 (0)