	public void testIntegerOverflowHmacBypass()
		throws Exception {
		
		SecretKey inputKey = new SecretKeySpec(INPUT_KEY_256, "AES");
		
		Assert.assertArrayEquals("Input key", INPUT_KEY_256, inputKey.getEncoded());
		byte[] iv = new byte[16];
		byte[] aad = new byte[8];
		byte[] plaintext = new byte[536870928];
		for (int i = 0; i < plaintext.length; i++ ){
			// Doesn't matter what value is, but rand is too expensive for large array
			plaintext[i] = (byte) i;
		}
		
		AuthenticatedCipherText act;
		
		try {
			act = AESCBC.encryptAuthenticated(inputKey, iv, plaintext, aad, null, null);
		} catch (OutOfMemoryError e) {
			System.out.println("Test not run due to " + e);
			return;
		}
		
		byte[] ciphertext = act.getCipherText();
		byte[] authTag = act.getAuthenticationTag();
		
		// Now shift aad and ciphertext around so that HMAC doesn't change,
		// but the plaintext will change.
		int n = 0;
		byte[] buffer = new byte[aad.length + iv.length + ciphertext.length];
		System.arraycopy(aad, 0, buffer, n, aad.length);
		n += aad.length;
		System.arraycopy(iv, 0, buffer, n, iv.length);
		n += iv.length;
		System.arraycopy(ciphertext, 0, buffer, n, ciphertext.length);
		// Note that due to integer overflow :536870920 * 8 = 64
		int newAadSize = 536870920;
		byte[] newAad = Arrays.copyOfRange(buffer, 0, newAadSize);
		byte[] newIv = Arrays.copyOfRange(buffer, newAadSize, newAadSize + 16);
		byte[] newCiphertext = Arrays.copyOfRange(buffer, newAadSize + 16,
			buffer.length);
		
		try {
			byte[] decrypted = AESCBC.decryptAuthenticated(inputKey, newIv,
				newCiphertext, newAad,
				authTag, // Note that the authTag does NOT change.
				null, null);
			// Reaching this point means that the HMac check is
			// bypassed although the decrypted data is different
			// from plaintext.
			// Assert.assertArrayEquals(decrypted, plaintext);
			fail();
		} catch (JOSEException ignored) {
			// ok
		}
	}
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.