On Thu, 11 Sep 2025 00:54:04 GMT, Jamil Nimeh <jni...@openjdk.org> wrote:
>> This fix resolves an issue where the `Cipher.updateAAD(ByteBuffer)` method, >> when used on a ChaCha20-Poly1305 Cipher, may throw an exception due to an >> offset calculation error. This occurs when the ByteBuffer is array-backed, >> and when the buffer passed into the method is a slice of another >> array-backed buffer and that slice begins at a non-zero offset in the parent >> ByteBuffer. >> >> Credit and thanks to @jaikiran for finding the issue and providing >> reproducer code. > > Jamil Nimeh has updated the pull request incrementally with one additional > commit since the last revision: > > Add tests for encryption correctness, also add tests for MemorySegment > ByteBuffers test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/UpdateAADTest.java line 74: > 72: > 73: public interface TestAction { > 74: void runTest(ByteBuffer buffer); If you allow `runTest` to throw an exception, then there is no need to catch and rethrow in the 2 instances. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27081#discussion_r2344388738