On Thu, 29 Oct 2026 06:17:50 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> FrameSetView parses percentage values from HTML frameset attributes using an 
> int. 
> So, large values can overflow and become zero or negative. 
> For example, 4294967296% which is 2^32 is parsed as zero, causing the frame 
> to receive an incorrect share of the available space.
> 
> The fix checks whether adding the next digit would exceed Integer.MAX_VALUE. 
> If so, it returns Integer.MAX_VALUE. 
> Values within the supported range retain their existing behavior.
> 
> The subsequent percentage calculations also is needed to use long arithmetic 
> to prevent overflow, when adding percentages, normalizing them to a total of 
> 100%, and converting percentages into pixel sizes. 
> 
> 
> 
> ---------
> - [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: 7460f4af
Author:    Prasanta Sadhukhan <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/7460f4afdd711a5bac40dbba03d64095099dab24
Stats:     99 lines in 2 files changed: 94 ins; 0 del; 5 mod

8393731: Integer overflow in FrameSetView.parseDigits() silently converts large 
positive values to zero

Reviewed-by: prr, kizune

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

PR: https://git.openjdk.org/jdk/pull/33623

Reply via email to