RFR: 8055461: getNextID in ImageIcon class can lead to overflow
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Jun 11 12:40:28 UTC 2025
On Fri, 6 Jun 2025 03:29:47 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> ImageIcon.getNextID uses `mediaTrackerID ` which do not detect overflow.
>
> Theoretically there is a possibility that there can be overflow in the long time run or for large number of created "imageIcon"
>
> Made sure there is no overflow and treat that loadImage as ABORTED
>
> No regression testcase as it addresses theoretical possibility..
Something like this
ImageIcon icon = new ImageIcon();
Image image = Toolkit.getDefaultToolkit().createImage("onepixel.gif");
icon.setImage(image);
if (icon.getImageLoadStatus == MediaTracker.ABORTED) {
ImageIcon newIcon = new ImageIcon();
}
in this case wont mediaTrackerId starts from 0 again for "newIcon"?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25666#issuecomment-2962527159
More information about the client-libs-dev
mailing list