1
0
Fork 0

fix invalid "out of memory" message when using out-of-range coordinates for the geo index

This commit is contained in:
jsteemann 2018-04-10 11:58:07 +02:00
parent 46b7dbcf75
commit baf2303c16
2 changed files with 15 additions and 3 deletions

View File

@ -144,11 +144,17 @@ size_t MMFilesGeoIndexIterator::findLastIndex(GeoCoordinates* coords) const {
bool MMFilesGeoIndexIterator::next(LocalDocumentIdCallback const& cb, size_t limit) {
if (!_cursor) {
createCursor(_lat, _lon);
if (_lat < -90.0 || _lat > 90.0 || _lon < -180.0 || _lon > 180.0) {
// invalid coordinates
_done = true;
return false;
}
createCursor(_lat, _lon);
if (!_cursor) {
// actually validate that we got a valid cursor
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to create cursor");
}
}

View File

@ -149,11 +149,17 @@ size_t RocksDBGeoIndexIterator::findLastIndex(GeoCoordinates* coords) const {
bool RocksDBGeoIndexIterator::next(LocalDocumentIdCallback const& cb, size_t limit) {
if (!_cursor) {
if (_lat < -90.0 || _lat > 90.0 || _lon < -180.0 || _lon > 180.0) {
// invalid coordinates
_done = true;
return false;
}
createCursor(_lat, _lon);
if (!_cursor) {
// actually validate that we got a valid cursor
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to create cursor");
}
}