From cafa56d6f6dd7f0dc08072531b80935b3250d386 Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Sat, 19 May 2018 08:48:55 -0700 Subject: [PATCH 1/2] Horner degree must be a positive integer Found with autofuzz --- src/PJ_horner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PJ_horner.c b/src/PJ_horner.c index 50e1385058..674520422f 100644 --- a/src/PJ_horner.c +++ b/src/PJ_horner.c @@ -454,9 +454,9 @@ PJ *PROJECTION(horner) { /* Polynomial degree specified? */ if (pj_param (P->ctx, P->params, "tdeg").i) { /* degree specified? */ degree = pj_param(P->ctx, P->params, "ideg").i; - if (degree > 10000) { - /* What is a reasonable maximum for the degree? */ - proj_log_debug (P, "Horner: Degree too large: %d", degree); + if (degree < 0 || degree > 10000) { + /* What are reasonable minimum and maximums for degree? */ + proj_log_debug (P, "Horner: Degree is unreasnable: %d", degree); return horner_freeup (P, PJD_ERR_INVALID_ARG); } } else { From fea5387d540bd830d8a2c24d1af657680b92527d Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Sat, 19 May 2018 16:25:45 -0700 Subject: [PATCH 2/2] Horner: fix typo in error message --- src/PJ_horner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PJ_horner.c b/src/PJ_horner.c index 674520422f..09554a7f23 100644 --- a/src/PJ_horner.c +++ b/src/PJ_horner.c @@ -456,7 +456,7 @@ PJ *PROJECTION(horner) { degree = pj_param(P->ctx, P->params, "ideg").i; if (degree < 0 || degree > 10000) { /* What are reasonable minimum and maximums for degree? */ - proj_log_debug (P, "Horner: Degree is unreasnable: %d", degree); + proj_log_debug (P, "Horner: Degree is unreasonable: %d", degree); return horner_freeup (P, PJD_ERR_INVALID_ARG); } } else {