From 079ce89d3f7ab0bfa7a5c3baaeebe4548d8a4ea5 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 19 Oct 2023 15:08:42 +0200 Subject: [PATCH] [bugfux] Avoid IndexOutOfBoundsException --- exist-core/src/main/java/org/exist/xquery/value/Type.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exist-core/src/main/java/org/exist/xquery/value/Type.java b/exist-core/src/main/java/org/exist/xquery/value/Type.java index 8f1bf0b6469..935097d6877 100644 --- a/exist-core/src/main/java/org/exist/xquery/value/Type.java +++ b/exist-core/src/main/java/org/exist/xquery/value/Type.java @@ -559,6 +559,11 @@ public static int getSuperType(final int subtype) { return subtype; } + if (subtype >= superTypes.length) { + // Note that EMPTY_SEQUENCE is *not* a sub-type of anything else than itself + throw new IllegalArgumentException("Type: " + subtype + " has no super types defined"); + } + final int supertype = superTypes[subtype]; if (supertype == 0) { LOG.warn("eXist-db does not define a super-type for the sub-type {}", getTypeName(subtype), new Throwable());