-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
zstd uses memset to zero-initialize/reset some allocated structs. For example:
static void ZSTD_initCCtx(ZSTD_CCtx* cctx, ZSTD_customMem memManager)
{
assert(cctx != NULL);
ZSTD_memset(cctx, 0, sizeof(*cctx));
cctx->customMem = memManager;
cctx->bmi2 = ZSTD_cpuSupportsBmi2();
{ size_t const err = ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters);
assert(!ZSTD_isError(err));
(void)err;
}
}Currently Goblint completely invalidates the variable under memset, destroying all precision in the struct (especially if it's a global or an alloc variable).
Instead, memsetting to 0 (if the memset length equals the struct size) could be handled better to zero-initialize the abstract value, a la calloc.