Skip to content

Commit

Permalink
Fix bug in OpenSSLAeadCipher with empty plaintext. (#1281)
Browse files Browse the repository at this point in the history
If the user wants to encrypt and calls doFinal(input, 123, 0); without a prior call to update,
it currently fails with an array out of bounds exception.

Instead, it should encrypt the empty string.
  • Loading branch information
juergw authored Dec 19, 2024
1 parent 94d4d51 commit 77c9752
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/src/main/java/org/conscrypt/OpenSSLAeadCipher.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ int doFinalInternal(byte[] input, int inputOffset, int inputLen,
inOffset = 0;
inLen = bufCount;
} else {
if (inputLen == 0) {
if (inputLen == 0 && input == null) {
in = EmptyArray.BYTE; // input can be null when inputLen == 0
} else {
in = input;
Expand Down

0 comments on commit 77c9752

Please sign in to comment.