[patches:#562] fix crash with large arrays

Status: open
Group: bugfix
Labels: puredata crash array out-of-memory
Created: Mon Oct 05, 2015 06:05 PM UTC by IOhannes m zmölnig
Last Updated: Mon Oct 05, 2015 06:05 PM UTC
Owner: Miller Puckette
Attachments:

when creating largish tables (e.g. [table foo 1e9] on my 64bit machine with only 8GB of RAM), Pd crashes.

resizebytes() correctly reports out-of-memory, but unfortunately array_resize() ignores this and happily tries to initialize the 1st few gigabyte of memory starting at 0x0000, resulting in a crash.

attached patch fixes this by cancelling the resize-request when an out-of-memory is detected.
(the array stays untouched in this case).

while this might not be what the user expects, a crash is certainly even less deisrable. (and at least it is possible to check the size of the array after a resize, so a patch stays consistent).

there are a few more unchecked calls to resizebytes() (and getbytes()), but i think it is easiest to get an out-of-memory with requesting huge arrays; so this is the most important use to fix.


Sent from sourceforge.net because pd-dev@lists.iem.at is subscribed to https://sourceforge.net/p/pure-data/patches/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/pure-data/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.