QSvgFontStyle: Limit font weights earlier to avoid overflows


Since we limit the values anyway, we can easily do this before using
them for calculations.

I thought about removing the qBound() at the end and having it in
all three branches of the "if" condition, instead. I chose not to
do that because it could change the value states.fontWeight has
when leaving this function - with whatever implications that might
have. The changes I made are supposed to not change any values or
behavior except for avoiding the overflows.

Credit to OSS-Fuzz which found this as issue 510580899.

Pick-to: 6.11 6.8
Change-Id: I41600755453f72602686ec8cf718a634da8d7215
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
commit6f37dcaecb697f32fd584bb1bef9be6cb203366b
parentcadf0b8609a14ad5951900446211da8b11a66ffc
authorRobert Löhning <robert.loehning@qt.io>
committerRobert Löhning <robert.loehning@qt.io>
commit timeMon, 18 May 2026 08:15:08 +0000