Repository navigation
Commit f451d0c
Clamp speculative RSS reservation against
`MemoryWorker::updateResidentMemoryThread` was multiplying `delta` by
`rss_speculative_reserve_ratio` and adding the result to `resident`
without any bounds check. A very large configured ratio could overflow
the `double -> Int64` conversion (UB) or the signed `Int64` addition,
producing a negative or wrap-around `rss` value and weakening the global
hard-limit check inside `MemoryTracker::allocImpl`.
Compute the maximum admissible reservation as
`std::numeric_limits<Int64>::max() - resident`, compare against the
unrounded `double` product before casting, and clamp. Spotted by AI
review on #104976.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>Int64 overflow1 parent 88104b9 commit f451d0c
1 file changed
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
434 | 435 | | |
435 | 436 | | |
436 | 437 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
447 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
448 | 459 | | |
449 | 460 | | |
450 | 461 | | |
| |||
0 commit comments