FS#9938 - Better handling of out of memory errors in Tremor
Opened by Magnus Holmgren (learman) - Sunday, 22 February 2009, 13:17 GMT
Last edited by Magnus Holmgren (learman) - Sunday, 08 March 2009, 13:50 GMT
Tremor, the Vorbis decoder library, doesn't always check the result of malloc, which can cause Rockbox to crash on some files (e.g., if they have really big comments, as in
The setjmp/longjmp implementation is from newlib 1.17.0, with a few minor changes (mainly the combination of a few files, and removal of support for some architectures we don't need). Some sort of file header should probably be added to the files from newlib, but I'm not sure exactly what that should look like.
The changes to the "previous_section" variable were done to avoid a warning about it being clobbered by longjmp.
I've (quickly) tested this on ARM (e200) and ColdFire (h140) and it seems to work as expected. It would be good to test this on some other ARM-based targets (assuming this fix is acceptable). Having MIPS support could be nice too (this would involve adding newlib/libc/machine/mips/setjmp.S, perhaps with a few adjustments, as well as updating the CPU check in setjmp.h), but I don't have any MIPS target to test with.
Sunday, 08 March 2009, 13:50 GMT
Reason for closing: Accepted