Index: Bidi.java =================================================================== --- Bidi.java (revision 429253) +++ Bidi.java (working copy) @@ -424,6 +424,9 @@ */ public static void reorderVisually(byte[] levels, int levelStart, Object[] objects, int objectStart, int count) { + if (count < 0) { + throw new IllegalArgumentException("count " + count + " must be >= 0"); + } try { byte[] realLevels = new byte[count]; System.arraycopy(levels, levelStart, realLevels, 0, count);