Commit 1eac243
Fix signed integer overflow UB in opt_tryParseDouble exponent parsing
The exponent accumulation loop `exponent *= 10` could overflow int
for inputs like "1.0e9999999999", which is undefined behavior in C++.
Clamped to 0x7FFFFFF (~134M) before the multiply — values above 308
already exceed double range, so further digits are irrelevant.
Only affects TINYOBJLOADER_DISABLE_FAST_FLOAT builds (the hand-written
float parser fallback). Verified with UBSan fuzzing (15K iterations).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 19f8f03 commit 1eac243
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10159 | 10159 | | |
10160 | 10160 | | |
10161 | 10161 | | |
10162 | | - | |
10163 | | - | |
| 10162 | + | |
| 10163 | + | |
| 10164 | + | |
| 10165 | + | |
| 10166 | + | |
| 10167 | + | |
10164 | 10168 | | |
10165 | 10169 | | |
10166 | 10170 | | |
| |||
0 commit comments