RFR: 8055461: getNextID in ImageIcon class can lead to overflow [v2]

Alexey Ivanov aivanov at openjdk.org
Wed Jun 11 16:14:32 UTC 2025


On Wed, 11 Jun 2025 15:04:21 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..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Reset mediaTrackerID if it overflows

I've been trying to verify whether the fix is even necessary. My test case has been running for a few hours, and it reached only 0x30000000.

I will need to update the test case to cause the overflow from negative number to positive again. Let's see.

I still like the idea of not touching anything better than fixing this potential issue which doesn't seem to cause much trouble, at least from analysing the code.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25666#issuecomment-2963415320


More information about the client-libs-dev mailing list