On Tue, 17 Feb 2026 19:17:27 GMT, Phil Race <[email protected]> wrote:
> This fix updates DataBuffer subclasses to actually adhere to their stated > specifications by rejecting certain invalid parameters for constructors and > getters and setters. > A new egression test for each of the constructor and getter/setter cases is > supplied. > > No existing regression tests fail with this change, and standard demos work. > > Problems caused by these changes are most likely to occur if the client has a > bug such that > - a client uses the constructors that accept an array and then supplies a > "size" that is greater than the array. > - a client uses the constructors that accept an array and then supplies a > "size" that is less than the array and then uses getter/setters that are > within the array but outside the range specified by size. > > Since very few clients (and just one case in the JDK that I found) even use > these array constructors the changes are unlikely to make a difference to > clients. > > The CSR is ready for review https://bugs.openjdk.org/browse/JDK-8378116 > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). This pull request has now been integrated. Changeset: b4857298 Author: Phil Race <[email protected]> URL: https://git.openjdk.org/jdk/commit/b48572985910136c6dc803228420b88b59e523e5 Stats: 1649 lines in 9 files changed: 1602 ins; 22 del; 25 mod 8377568: DataBuffer constructors and methods do not specify required exceptions 4393297: Doc probs in java.awt.image.DataBufferInt 4398379: java.awt.image.DataBufferShort constructor should verify size of array 4398381: java.awt.image.DataBufferShort should check for negative size 8265647: DataBufferUShort constructors check 'dataArray' for 'null' after dereference Reviewed-by: aivanov, azvegint, jdv ------------- PR: https://git.openjdk.org/jdk/pull/29766
