mirror of https://gitee.com/bigwinds/arangodb
fix invalid "out of memory" message when using out-of-range coordinates for the geo index
This commit is contained in:
parent
46b7dbcf75
commit
baf2303c16
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue