[legacy] Fix bug in ZSTD_decodeSeqHeaders()
This commit is contained in:
parent
ac098c7f5f
commit
579f3d7794
@ -3242,14 +3242,12 @@ static size_t ZSTDv06_decodeSeqHeaders(int* nbSeqPtr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FSE table descriptors */
|
/* FSE table descriptors */
|
||||||
|
if (ip + 4 > iend) return ERROR(srcSize_wrong); /* min : header byte + all 3 are "raw", hence no header, but at least xxLog bits per type */
|
||||||
{ U32 const LLtype = *ip >> 6;
|
{ U32 const LLtype = *ip >> 6;
|
||||||
U32 const Offtype = (*ip >> 4) & 3;
|
U32 const Offtype = (*ip >> 4) & 3;
|
||||||
U32 const MLtype = (*ip >> 2) & 3;
|
U32 const MLtype = (*ip >> 2) & 3;
|
||||||
ip++;
|
ip++;
|
||||||
|
|
||||||
/* check */
|
|
||||||
if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at least xxLog bits per type */
|
|
||||||
|
|
||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
{ size_t const bhSize = ZSTDv06_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
|
{ size_t const bhSize = ZSTDv06_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
|
||||||
if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
|
if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
|
||||||
|
@ -3470,14 +3470,12 @@ static size_t ZSTDv07_decodeSeqHeaders(int* nbSeqPtr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FSE table descriptors */
|
/* FSE table descriptors */
|
||||||
|
if (ip + 4 > iend) return ERROR(srcSize_wrong); /* min : header byte + all 3 are "raw", hence no header, but at least xxLog bits per type */
|
||||||
{ U32 const LLtype = *ip >> 6;
|
{ U32 const LLtype = *ip >> 6;
|
||||||
U32 const OFtype = (*ip >> 4) & 3;
|
U32 const OFtype = (*ip >> 4) & 3;
|
||||||
U32 const MLtype = (*ip >> 2) & 3;
|
U32 const MLtype = (*ip >> 2) & 3;
|
||||||
ip++;
|
ip++;
|
||||||
|
|
||||||
/* check */
|
|
||||||
if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at least xxLog bits per type */
|
|
||||||
|
|
||||||
/* Build DTables */
|
/* Build DTables */
|
||||||
{ size_t const llhSize = ZSTDv07_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
|
{ size_t const llhSize = ZSTDv07_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
|
||||||
if (ZSTDv07_isError(llhSize)) return ERROR(corruption_detected);
|
if (ZSTDv07_isError(llhSize)) return ERROR(corruption_detected);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user