diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-10-28 15:12:20 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-10-28 15:12:20 +0100 |
| commit | 2366a528aa1bce3f9ccfea5940154dc7c6c947be (patch) | |
| tree | 4fc48bc2c69b5ce978c2e95d9ef56c057870db8b /test/unit/test_operation.cpp | |
| parent | 9526fb84a78be9454fdc71e01fb7f73a5955f993 (diff) | |
| download | PROJ-2366a528aa1bce3f9ccfea5940154dc7c6c947be.tar.gz PROJ-2366a528aa1bce3f9ccfea5940154dc7c6c947be.zip | |
createOperations(): avoid infinite recursion in a super weird case. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18587
Diffstat (limited to 'test/unit/test_operation.cpp')
| -rw-r--r-- | test/unit/test_operation.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 8805e6a1..739d8ec3 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -7652,6 +7652,26 @@ TEST(operation, createOperation_on_crs_with_bound_crs_and_wktext) { // --------------------------------------------------------------------------- +TEST(operation, createOperation_ossfuzz_18587) { + auto objSrc = + createFromUserInput("EPSG:4326", DatabaseContext::create(), false); + auto src = nn_dynamic_pointer_cast<CRS>(objSrc); + ASSERT_TRUE(src != nullptr); + + // Extremly weird string ! We should likely reject it + auto objDst = PROJStringParser().createFromPROJString( + "type=crs proj=pipeline step proj=merc vunits=m nadgrids=@x " + "proj=\"\nproj=pipeline step\n\""); + auto dst = nn_dynamic_pointer_cast<CRS>(objDst); + ASSERT_TRUE(dst != nullptr); + + // Just check that we don't go into an infinite recursion + CoordinateOperationFactory::create()->createOperation(NN_CHECK_ASSERT(src), + NN_CHECK_ASSERT(dst)); +} + +// --------------------------------------------------------------------------- + TEST(operation, mercator_variant_A_to_variant_B) { auto projCRS = ProjectedCRS::create( PropertyMap(), GeographicCRS::EPSG_4326, |
