diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-04-18 22:12:55 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-04-18 22:12:55 +0200 |
| commit | 4c8a5cb8c7f69dd227f03f32eb99b53ea0586aba (patch) | |
| tree | ce51488f47e972692a24ed2b08ec74e6261b6b46 | |
| parent | cf0a6384741354811f821f1cc63bb7f2b69b9924 (diff) | |
| download | PROJ-4c8a5cb8c7f69dd227f03f32eb99b53ea0586aba.tar.gz PROJ-4c8a5cb8c7f69dd227f03f32eb99b53ea0586aba.zip | |
isea: avoid invalid integer shift
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14286
Credit to OSS Fuzz
| -rw-r--r-- | src/projections/isea.cpp | 4 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/projections/isea.cpp b/src/projections/isea.cpp index 28510cb0..e8720b27 100644 --- a/src/projections/isea.cpp +++ b/src/projections/isea.cpp @@ -898,6 +898,10 @@ static int isea_hex(struct isea_dgg *g, int tri, quad = isea_ptdi(g, tri, pt, &v); + if( v.x < (INT_MIN >> 4) || v.x > (INT_MAX >> 4) ) + { + throw "Invalid shift"; + } hex->x = ((int)v.x << 4) + quad; hex->y = v.y; diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 631767a3..0f583454 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2167,6 +2167,9 @@ expect -1575486.353641554 3442168.342028188 accept -2 -1 expect -1575486.353880283 3234352.695594706 +operation +proj=isea +mode=hex +resolution=31 +accept 0 0 +expect failure =============================================================================== Kavraisky V |
