From c7d5a54b42a88fc89dff6942dde99b79c3e36cdf Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Thu, 1 Feb 2018 09:01:48 +0100 Subject: [PATCH] Fix AIOOB on indexed geo_shape query (#28458) This change fixes a possible AIOOB during the parsing of the document that contains the indexed shape. This change ensures that the parsing does not continue when the field that contains the shape has been found. Closes #28456 --- .../index/query/GeoShapeQueryBuilder.java | 1 + .../query/GeoShapeQueryBuilderTests.java | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java index c4a6f7fa6b7..5fb97769463 100644 --- a/server/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java @@ -409,6 +409,7 @@ public class GeoShapeQueryBuilder extends AbstractQueryBuilder query.toQuery(createShardContext())); assertEquals("query must be rewritten first", e.getMessage()); @@ -244,6 +239,23 @@ public class GeoShapeQueryBuilderTests extends AbstractQueryTestCase