From 1c3678b636ecc4860a24a137886de88f2813808c Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 9 Feb 2020 03:47:13 +0100 Subject: read_vgrid_value(): avoid assertion on huge latitude. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20592. master only --- src/grids.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/grids.cpp') diff --git a/src/grids.cpp b/src/grids.cpp index b641f088..ec447a33 100644 --- a/src/grids.cpp +++ b/src/grids.cpp @@ -3137,6 +3137,9 @@ static double read_vgrid_value(PJ_CONTEXT *ctx, const ListOfVGrids &grids, pj_ctx_set_errno(ctx, PJD_ERR_GRID_AREA); return HUGE_VAL; } + if (grid->isNullGrid()) { + return 0; + } const auto &extent = grid->extentAndRes(); @@ -3336,6 +3339,12 @@ bool pj_bilinear_interpolation_three_samples(const GenericShiftGrid *grid, double &v2, double &v3, bool &must_retry) { must_retry = false; + if (grid->isNullGrid()) { + v1 = 0.0; + v2 = 0.0; + v3 = 0.0; + return true; + } const auto &extent = grid->extentAndRes(); double grid_x = (lp.lam - extent.westLon) / extent.resLon; -- cgit v1.2.3