changeset 13244:d697bbac7ece

8203654: Improve cypher state updates Reviewed-by: ascarpino
author igerasim
date Tue, 19 Jun 2018 10:56:20 -0700
parents 7f473886abb4
children ce4e64dd600b
files src/share/classes/javax/crypto/Cipher.java src/share/classes/javax/crypto/spec/GCMParameterSpec.java
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/crypto/Cipher.java	Thu Jun 14 15:32:54 2018 -0700
+++ b/src/share/classes/javax/crypto/Cipher.java	Tue Jun 19 10:56:20 2018 -0700
@@ -2703,7 +2703,7 @@
 
         // Input sanity check
         if ((src == null) || (offset < 0) || (len < 0)
-                || ((len + offset) > src.length)) {
+                || (len > (src.length - offset))) {
             throw new IllegalArgumentException("Bad arguments");
         }
 
--- a/src/share/classes/javax/crypto/spec/GCMParameterSpec.java	Thu Jun 14 15:32:54 2018 -0700
+++ b/src/share/classes/javax/crypto/spec/GCMParameterSpec.java	Tue Jun 19 10:56:20 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
 
         // Input sanity check
         if ((src == null) ||(len < 0) || (offset < 0)
-                || ((len + offset) > src.length)) {
+                || (len > (src.length - offset))) {
             throw new IllegalArgumentException("Invalid buffer arguments");
         }