Commit f3fbb5f ("[malloc] Avoid integer overflow for excessively large memory allocations") fixed signed integer overflow issues caused by the use of ssize_t, but did not guard against unsigned integer overflow. Add explicit checks for unsigned integer overflow where needed. As a side bonus, erroneous calls to malloc_dma() with an (illegal) size of zero will now fail cleanly. Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
291 |
|
291 |
|
292 |
|
292 |
|
293 |
|
293 |
|
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
294 |
|
303 |
|
295 |
|
304 |
|
296 |
|
|
|
297 |
|
305 |
|
298 |
|
306 |
|
299 |
|
307 |
|
|
|
||
302 |
|
310 |
|
303 |
|
311 |
|
304 |
|
312 |
|
305 |
|
|
|
|
313 |
|
|
|
314 |
|
|
306 |
|
315 |
|
307 |
|
316 |
|
308 |
|
317 |
|
|
|
||
506 |
|
515 |
|
507 |
|
516 |
|
508 |
|
517 |
|
|
518 |
|
|
|
519 |
|
|
509 |
|
520 |
|
510 |
|
521 |
|
511 |
|
522 |
|