diff --git a/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java b/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java index d59a825e6fa..a4f9971550a 100644 --- a/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java +++ b/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java @@ -60,6 +60,11 @@ public final class TrieRangeFilter extends Filter { this.max=(max==null) ? trieVariant.TRIE_CODED_NUMERIC_MAX : ( maxInclusive ? max : variant.decrementTrieCoded(max) ); + // check encoded values + if ( + this.min.length() != trieVariant.TRIE_CODED_LENGTH || + this.max.length() != trieVariant.TRIE_CODED_LENGTH + ) throw new NumberFormatException("Invalid trie encoded numerical value representation (incompatible length)."); } /**