Skip to content

Missing check on failed allocation leads to NULL-ptr dereference #4026

@benhawkes

Description

@benhawkes

Describe the bug

In the ZBUFFv06_createDCtx function in lib/legacy/zstd_v06.c, there is an unchecked allocation failure that can result in a NULL-ptr dereference when calling ZSTD_decompressStream in low-memory conditions. Specifically the following line in ZBUFFv06_createDCtx is unchecked:

zbd->zd = ZSTDv06_createDCtx();

If this allocation fails, a NULL-ptr deference in ZSTDv06_decompressBegin (via ZSTDv06_decompressBegin_usingDict) can be observed.

It looks like there are similar cases in lib/legacy/zstd_v05.c and lib/legacy/zstd_v04.c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions