mapbox / geojson-cpp

A C++14 library for converting GeoJSON into geometry.hpp representation
ISC License
66 stars 27 forks source link

Fix SEGV due to invalid geoJSON and add validation #42

Closed im029 closed 4 years ago

im029 commented 4 years ago

While parsing geoJSON, malformed inputs can cause the program to crash mapbox/api-gl#1530 (comment). The main reason of crash is the assertion failure in RapidJSON library when calling size() method. Turns out, malformed geoJSON can lead to a call to size() on an object that is not an array.

This pr fixes the issue by calling IsArray() before a call to size()

GL-Native issue: #562