Skip to content

Commit affa711

Browse files
committed
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.
1 parent b0a179d commit affa711

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

contrib/seekable_format/zstdseek_decompress.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ size_t ZSTD_seekable_free(ZSTD_seekable* zs)
252252

253253
ZSTD_seekTable* ZSTD_seekTable_create_fromSeekable(const ZSTD_seekable* zs)
254254
{
255+
if (zs->seekTable.entries == NULL) return NULL;
255256
ZSTD_seekTable* const st = (ZSTD_seekTable*)malloc(sizeof(ZSTD_seekTable));
256257
if (st==NULL) return NULL;
257258

0 commit comments

Comments
 (0)