1
0
Fork 0
forked from len0rd/rockbox

buflib: Add crc field protecting buflib cookie integrity

This should catch the case of buffer misuse which results
in corrupted cookie of next allocation. The check is performed
on move_block() so it may be a bit late.

There is buflib_check_valid() provided which checks the
integrity of all cookies for given context.
On DEBUG build with --sdl-thread this check is carried out
for core_ctx on every context switch to catch problems earlier.

Change-Id: I999d4576084592394e3dbd3bdf0f32935ff5f601
Reviewed-on: http://gerrit.rockbox.org/711
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
This commit is contained in:
Marcin Bukat 2014-01-09 21:37:07 +01:00
parent 7f5dce4116
commit 7ab237b025
9 changed files with 95 additions and 13 deletions

View file

@ -32,6 +32,7 @@
#include "kernel.h"
#include "thread.h"
#include "debug.h"
#include "core_alloc.h"
/* Define this as 1 to show informational messages that are not errors. */
#define THREAD_SDL_DEBUGF_ENABLED 0
@ -382,6 +383,9 @@ void switch_thread(void)
} /* STATE_SLEEPING: */
}
#ifdef DEBUG
core_check_valid();
#endif
cores[CURRENT_CORE].running = current;
if (threads_status != THREADS_RUN)