Commit 6b60354
committed
vm-mempool: widen heap size multiply to size_t
The obj_size (uint16_t) * capacity (uint32_t) product was evaluated in
32-bit and only then widened to the size_t that the allocator takes, so
a product over 4 GB would wrap before the widening. Current callers
derive capacity from fixed pool-size config (~10 MB max), so this is not
triggerable today, but cast one operand to size_t to do the multiply in
64-bit as defensive hardening against future pool-size increases.1 parent e29f53b commit 6b60354
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
0 commit comments