Skip to content

Commit 878b31a

Browse files
committed
Avoid recursion crash under misuse
The "end - start < 1" case shouldn't ever be reached, but we can still code defensively if the case is hit. The result might not be well-defined but it at least won't crash the whole JVM. Signed-off-by: Simeon Widdis <[email protected]>
1 parent 577d2bd commit 878b31a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/opensearch/sql/analysis/ExpressionAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ private Expression visitIn(
316316
* @return The final `DSL.or` expression.
317317
*/
318318
private Expression buildOrTree(Expression[] children, int start, int end) {
319-
if (end - start == 1) {
319+
if (end - start <= 1) {
320320
return children[start];
321321
}
322322
if (end - start == 2) {

0 commit comments

Comments
 (0)