From 61166380276a0e99b980dfdc6b43ea4656846c08 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 20 Mar 2019 18:13:12 +0100 Subject: laea: error out if |lat_0|>90 Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13829 Credit to OSS Fuzz --- src/projections/laea.cpp | 3 +++ test/gie/builtins.gie | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/projections/laea.cpp b/src/projections/laea.cpp index 22fb1691..11b89a96 100644 --- a/src/projections/laea.cpp +++ b/src/projections/laea.cpp @@ -248,6 +248,9 @@ PJ *PROJECTION(laea) { P->destructor = destructor; t = fabs(P->phi0); + if (t > M_HALFPI + EPS10 ) { + return destructor(P, PJD_ERR_LAT_LARGER_THAN_90); + } if (fabs(t - M_HALFPI) < EPS10) Q->mode = P->phi0 < 0. ? S_POLE : N_POLE; else if (fabs(t) < EPS10) diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 313d0631..0082d5cf 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2457,6 +2457,11 @@ tolerance 10 cm accept 45 45 roundtrip 100 +------------------------------------------------------------------------------- +Test error in projection setup +------------------------------------------------------------------------------- +operation +proj=laea +ellps=GRS80 +lat_0=91 +expect failure errno lat_larger_than_90 =============================================================================== Lagrange -- cgit v1.2.3