Commit 3beaa12
[emulator] Don't let map allocation failures cross the C ABI boundary
MapMemory allocates a buffer of a caller-controlled length; a std::bad_alloc /
length_error from a huge or garbage length would propagate out of the extern "C"
map functions, which is undefined behavior. Catch allocation failures in
EmulatorMemory::Map (the single point the four map FFI entry points funnel
through) and turn them into a logged no-op.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8103cc2 commit 3beaa12
1 file changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
208 | 219 | | |
209 | 220 | | |
210 | 221 | | |
| |||
222 | 233 | | |
223 | 234 | | |
224 | 235 | | |
225 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
226 | 248 | | |
227 | 249 | | |
228 | 250 | | |
| |||
0 commit comments