Fix srcSize=0 edge case
This commit is contained in:
parent
022e6d81e7
commit
48405b4633
@ -4694,6 +4694,16 @@ static size_t ZSTD_compressSequences_internal(void* dst, size_t dstCapacity,
|
|||||||
BYTE* op = (BYTE*)dst;
|
BYTE* op = (BYTE*)dst;
|
||||||
|
|
||||||
DEBUGLOG(4, "ZSTD_compressSequences_internal srcSize: %zu, inSeqsSize: %zu", srcSize, inSeqsSize);
|
DEBUGLOG(4, "ZSTD_compressSequences_internal srcSize: %zu, inSeqsSize: %zu", srcSize, inSeqsSize);
|
||||||
|
/* Special case: empty frame */
|
||||||
|
if (remaining == 0) {
|
||||||
|
U32 const cBlockHeader24 = 1 /* last block */ + (((U32)bt_raw)<<1);
|
||||||
|
RETURN_ERROR_IF(dstCapacity<4, dstSize_tooSmall, "No room for empty frame block header");
|
||||||
|
MEM_writeLE32(op, cBlockHeader24);
|
||||||
|
op += ZSTD_blockHeaderSize;
|
||||||
|
dstCapacity -= ZSTD_blockHeaderSize;
|
||||||
|
cSize += ZSTD_blockHeaderSize;
|
||||||
|
}
|
||||||
|
|
||||||
while (remaining) {
|
while (remaining) {
|
||||||
U32 cBlockSize;
|
U32 cBlockSize;
|
||||||
int additionalByteAdjustment;
|
int additionalByteAdjustment;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user