changeset 22119:62dc08c8b687

fixed bug in bounds check for crypto intrinsics
author Doug Simon <doug.simon@oracle.com>
date Mon, 29 Jun 2015 18:38:47 +0200
parents 6b5221d7b5c1
children 84d5125aa31a
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java	Mon Jun 29 17:24:09 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java	Mon Jun 29 18:38:47 2015 +0200
@@ -26,7 +26,6 @@
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 import static com.oracle.graal.word.Word.*;
-import static jdk.internal.jvmci.code.UnsignedMath.*;
 
 import java.lang.reflect.*;
 
@@ -93,7 +92,7 @@
      * Perform null and array bounds checks for arguments to a cipher operation.
      */
     static void checkArgs(byte[] in, int inOffset, byte[] out, int outOffset) {
-        if (probability(VERY_SLOW_PATH_PROBABILITY, aboveThan(inOffset + AES_BLOCK_SIZE, in.length) || aboveThan(outOffset + AES_BLOCK_SIZE, out.length))) {
+        if (probability(VERY_SLOW_PATH_PROBABILITY, inOffset < 0 || in.length - AES_BLOCK_SIZE < inOffset || outOffset < 0 || out.length - AES_BLOCK_SIZE < outOffset)) {
             DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
         }
     }