1
0
Fork 0
forked from len0rd/rockbox

buflib: Check the validity of of handles passed to buflib_get_data() in DEBUG builds.

Change-Id: Ic274bfb4a8e1a1a10f9a54186b9173dbc0faa4c8
This commit is contained in:
Thomas Martitz 2014-01-28 15:33:40 +01:00
parent d608d2203a
commit d66346789c
6 changed files with 326 additions and 2 deletions

View file

@ -898,6 +898,15 @@ const char* buflib_get_name(struct buflib_context *ctx, int handle)
}
#ifdef DEBUG
void *buflib_get_data(struct buflib_context *ctx, int handle)
{
if (handle <= 0)
buflib_panic(ctx, "invalid handle access: %d", handle);
return (void*)(ctx->handle_table[-handle].alloc);
}
void buflib_check_valid(struct buflib_context *ctx)
{
union buflib_data *crc_slot;