diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2014-01-09 21:37:07 +0100 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2014-01-16 10:17:39 +0100 |
commit | 7ab237b025cbb4c25d345604da32e894379c1721 (patch) | |
tree | 92d147029519c55d57db4273066d57b960ad7158 /firmware/core_alloc.c | |
parent | 7f5dce4116bf4e62e0cd3ef16730157e17625e1c (diff) |
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>
Diffstat (limited to 'firmware/core_alloc.c')
-rw-r--r-- | firmware/core_alloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/firmware/core_alloc.c b/firmware/core_alloc.c index aa662fbee5..e9f9795917 100644 --- a/firmware/core_alloc.c +++ b/firmware/core_alloc.c @@ -96,3 +96,10 @@ void core_print_block_at(int block_num, char* buf, size_t bufsize) { buflib_print_block_at(&core_ctx, block_num, buf, bufsize); } + +#ifdef DEBUG +void core_check_valid(void) +{ + buflib_check_valid(&core_ctx); +} +#endif |