You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This heap buffer overflow is a result of invalid memory allocation in the example program.
The (completely malformed) crash.svg creates an image with size 192 x 448888864.
The malloc(w*h*4) call does not detect an integer multiplication overflow (192*448888864*4 = 344746647552 bytes), resulting in much less memory (only 1149263872 bytes) allocated than needed, hence the buffer overflow later in nsvgRasterize()https://github.com/memononen/nanosvg/blob/93ce879dc4c04a3ef1758428ec80083c38610b1f/src/nanosvgrast.h#L1390().
Replacing the malloc() in the example program with:
size_tstride=w*4;
image=calloc(h, stride);
will immediately result in an an error Could not alloc image buffer..
run with args
a.out crash.svg
heap-buffer-overflow
The text was updated successfully, but these errors were encountered: