mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
prevent possible segfault when creating seek table
Add a check whether the seek table of a `ZSTD_seekable` is initialized before creating a new seek table from it. Return `NULL`, if the check fails.
This commit is contained in:
parent
b0a179d469
commit
b683c0dbe2
1 changed files with 2 additions and 0 deletions
|
|
@ -252,6 +252,8 @@ size_t ZSTD_seekable_free(ZSTD_seekable* zs)
|
|||
|
||||
ZSTD_seekTable* ZSTD_seekTable_create_fromSeekable(const ZSTD_seekable* zs)
|
||||
{
|
||||
assert(zs != NULL);
|
||||
if (zs->seekTable.entries == NULL) return NULL;
|
||||
ZSTD_seekTable* const st = (ZSTD_seekTable*)malloc(sizeof(ZSTD_seekTable));
|
||||
if (st==NULL) return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue