Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc054349 authored by Christopher Tate's avatar Christopher Tate
Browse files

Throw on illegal arguments to ArrayUtils.equals(a1, a2, len)

Specifically, throw an explicit IllegalArgumentException if
'len' is negative, rather than falling over in some other
way further down the line.

Change-Id: If955de7ec1a15aa9aa8c42b6994b059e0cdffcee
parent 71b00177
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,10 @@ public class ArrayUtils
     * @return true if they're equal, false otherwise
     */
    public static boolean equals(byte[] array1, byte[] array2, int length) {
        if (length < 0) {
            throw new IllegalArgumentException();
        }

        if (array1 == array2) {
            return true;
        }