Merge pull request #4201 from rorosen/seek-table-create-null-check

prevent possible segfault when creating seek table
This commit is contained in:
Yann Collet 2024-11-26 17:59:42 -08:00 committed by GitHub
commit 82d470564d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;