Merge pull request #579 from iburinoc/multiframe
Check to ensure ddict isn't null before dereferencedev
commit
31432cc57d
|
@ -1575,6 +1575,9 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx,
|
||||||
return op-ostart;
|
return op-ostart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const void* ZSTD_DDictDictContent(const ZSTD_DDict* ddict);
|
||||||
|
static size_t ZSTD_DDictDictSize(const ZSTD_DDict* ddict);
|
||||||
|
|
||||||
static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx,
|
static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx,
|
||||||
void* dst, size_t dstCapacity,
|
void* dst, size_t dstCapacity,
|
||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
|
@ -1582,6 +1585,17 @@ static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx,
|
||||||
const ZSTD_DDict* ddict)
|
const ZSTD_DDict* ddict)
|
||||||
{
|
{
|
||||||
void* const dststart = dst;
|
void* const dststart = dst;
|
||||||
|
|
||||||
|
if (ddict) {
|
||||||
|
if (dict) {
|
||||||
|
/* programmer error, these two cases should be mutually exclusive */
|
||||||
|
return ERROR(GENERIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
dict = ZSTD_DDictDictContent(ddict);
|
||||||
|
dictSize = ZSTD_DDictDictSize(ddict);
|
||||||
|
}
|
||||||
|
|
||||||
while (srcSize >= ZSTD_frameHeaderSize_prefix) {
|
while (srcSize >= ZSTD_frameHeaderSize_prefix) {
|
||||||
U32 magicNumber;
|
U32 magicNumber;
|
||||||
|
|
||||||
|
@ -1937,6 +1951,16 @@ struct ZSTD_DDict_s {
|
||||||
ZSTD_customMem cMem;
|
ZSTD_customMem cMem;
|
||||||
}; /* typedef'd to ZSTD_DDict within "zstd.h" */
|
}; /* typedef'd to ZSTD_DDict within "zstd.h" */
|
||||||
|
|
||||||
|
static const void* ZSTD_DDictDictContent(const ZSTD_DDict* ddict)
|
||||||
|
{
|
||||||
|
return ddict->dictContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t ZSTD_DDictDictSize(const ZSTD_DDict* ddict)
|
||||||
|
{
|
||||||
|
return ddict->dictSize;
|
||||||
|
}
|
||||||
|
|
||||||
static void ZSTD_refDDict(ZSTD_DCtx* dstDCtx, const ZSTD_DDict* ddict)
|
static void ZSTD_refDDict(ZSTD_DCtx* dstDCtx, const ZSTD_DDict* ddict)
|
||||||
{
|
{
|
||||||
ZSTD_decompressBegin(dstDCtx); /* init */
|
ZSTD_decompressBegin(dstDCtx); /* init */
|
||||||
|
|
Loading…
Reference in New Issue