aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-04 01:03:49 +0200
committerGitHub <noreply@github.com>2021-09-04 01:03:49 +0200
commit37d2bac78da52eb82dba9cfe17b38df3f54bcd7e (patch)
tree0293a3efc68f2a717d43a2fd02148f6895cc4c11 /src
parentd4b2acb3146a323c783e83f828f3dca240f96d41 (diff)
parent126991dea06eb7160fe572b147f8a74a306b5c58 (diff)
downloadPROJ-37d2bac78da52eb82dba9cfe17b38df3f54bcd7e.tar.gz
PROJ-37d2bac78da52eb82dba9cfe17b38df3f54bcd7e.zip
Merge pull request #2839 from rouault/fix_ossfuzz_31964
pj_obj_create(): avoid passing invalid ellipsoid parameters ot pj_calc_ellipsoid_params()
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/c_api.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp
index 1bf6cbf0..b27ac005 100644
--- a/src/iso19111/c_api.cpp
+++ b/src/iso19111/c_api.cpp
@@ -222,6 +222,13 @@ static PJ *pj_obj_create(PJ_CONTEXT *ctx, const IdentifiedObjectNNPtr &objIn) {
const auto &ellps = geodCRS->ellipsoid();
const double a = ellps->semiMajorAxis().getSIValue();
const double es = ellps->squaredEccentricity();
+ if (!(a > 0 && es >= 0)) {
+ proj_log_error(pj, _("Invalid ellipsoid parameters"));
+ proj_errno_set(pj,
+ PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE);
+ proj_destroy(pj);
+ return nullptr;
+ }
pj_calc_ellipsoid_params(pj, a, es);
assert(pj->geod == nullptr);
pj->geod = static_cast<struct geod_geodesic *>(