mirror of
				https://github.com/facebook/zstd.git
				synced 2025-10-31 00:27:46 +02:00 
			
		
		
		
	adapted long decoder to new decodeSequences
removed older decodeSequences
This commit is contained in:
		| @@ -1214,128 +1214,6 @@ ZSTD_updateFseStateWithDInfo(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, U16 | |||||||
|  |  | ||||||
| typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e; | typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e; | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * ZSTD_decodeSequence_old(): |  | ||||||
|  * @p longOffsets : tells the decoder to reload more bit while decoding large offsets |  | ||||||
|  *                  only used in 32-bit mode |  | ||||||
|  * @return : Sequence (litL + matchL + offset) |  | ||||||
|  */ |  | ||||||
| FORCE_INLINE_TEMPLATE seq_t |  | ||||||
| ZSTD_decodeSequence_old(seqState_t* seqState, const ZSTD_longOffset_e longOffsets) |  | ||||||
| { |  | ||||||
|     seq_t seq; |  | ||||||
|     /* |  | ||||||
|      * ZSTD_seqSymbol is a 64 bits wide structure. |  | ||||||
|      * It can be loaded in one operation |  | ||||||
|      * and its fields extracted by simply shifting or bit-extracting on aarch64. |  | ||||||
|      * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh |  | ||||||
|      * operations that cause performance drop. This can be avoided by using this |  | ||||||
|      * ZSTD_memcpy hack. |  | ||||||
|      */ |  | ||||||
| #if defined(__aarch64__) && (defined(__GNUC__) && !defined(__clang__)) |  | ||||||
|     ZSTD_seqSymbol llDInfoS, mlDInfoS, ofDInfoS; |  | ||||||
|     ZSTD_seqSymbol* const llDInfo = &llDInfoS; |  | ||||||
|     ZSTD_seqSymbol* const mlDInfo = &mlDInfoS; |  | ||||||
|     ZSTD_seqSymbol* const ofDInfo = &ofDInfoS; |  | ||||||
|     ZSTD_memcpy(llDInfo, seqState->stateLL.table + seqState->stateLL.state, sizeof(ZSTD_seqSymbol)); |  | ||||||
|     ZSTD_memcpy(mlDInfo, seqState->stateML.table + seqState->stateML.state, sizeof(ZSTD_seqSymbol)); |  | ||||||
|     ZSTD_memcpy(ofDInfo, seqState->stateOffb.table + seqState->stateOffb.state, sizeof(ZSTD_seqSymbol)); |  | ||||||
| #else |  | ||||||
|     const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state; |  | ||||||
|     const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state; |  | ||||||
|     const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state; |  | ||||||
| #endif |  | ||||||
|     seq.matchLength = mlDInfo->baseValue; |  | ||||||
|     seq.litLength = llDInfo->baseValue; |  | ||||||
|     {   U32 const ofBase = ofDInfo->baseValue; |  | ||||||
|         BYTE const llBits = llDInfo->nbAdditionalBits; |  | ||||||
|         BYTE const mlBits = mlDInfo->nbAdditionalBits; |  | ||||||
|         BYTE const ofBits = ofDInfo->nbAdditionalBits; |  | ||||||
|         BYTE const totalBits = llBits+mlBits+ofBits; |  | ||||||
|  |  | ||||||
|         U16 const llNext = llDInfo->nextState; |  | ||||||
|         U16 const mlNext = mlDInfo->nextState; |  | ||||||
|         U16 const ofNext = ofDInfo->nextState; |  | ||||||
|         U32 const llnbBits = llDInfo->nbBits; |  | ||||||
|         U32 const mlnbBits = mlDInfo->nbBits; |  | ||||||
|         U32 const ofnbBits = ofDInfo->nbBits; |  | ||||||
|  |  | ||||||
|         assert(llBits <= MaxLLBits); |  | ||||||
|         assert(mlBits <= MaxMLBits); |  | ||||||
|         assert(ofBits <= MaxOff); |  | ||||||
|         /* |  | ||||||
|          * As gcc has better branch and block analyzers, sometimes it is only |  | ||||||
|          * valuable to mark likeliness for clang, it gives around 3-4% of |  | ||||||
|          * performance. |  | ||||||
|          */ |  | ||||||
|  |  | ||||||
|         /* sequence */ |  | ||||||
|         {   size_t offset; |  | ||||||
|             if (ofBits > 1) { |  | ||||||
|                 ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1); |  | ||||||
|                 ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5); |  | ||||||
|                 ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32); |  | ||||||
|                 ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits); |  | ||||||
|                 if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) { |  | ||||||
|                     /* Always read extra bits, this keeps the logic simple, |  | ||||||
|                      * avoids branches, and avoids accidentally reading 0 bits. |  | ||||||
|                      */ |  | ||||||
|                     U32 const extraBits = LONG_OFFSETS_MAX_EXTRA_BITS_32; |  | ||||||
|                     offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits); |  | ||||||
|                     BIT_reloadDStream(&seqState->DStream); |  | ||||||
|                     offset += BIT_readBitsFast(&seqState->DStream, extraBits); |  | ||||||
|                 } else { |  | ||||||
|                     offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */ |  | ||||||
|                     if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); |  | ||||||
|                 } |  | ||||||
|                 seqState->prevOffset[2] = seqState->prevOffset[1]; |  | ||||||
|                 seqState->prevOffset[1] = seqState->prevOffset[0]; |  | ||||||
|                 seqState->prevOffset[0] = offset; |  | ||||||
|             } else { |  | ||||||
|                 U32 const ll0 = (llDInfo->baseValue == 0); |  | ||||||
|                 if (LIKELY((ofBits == 0))) { |  | ||||||
|                     offset = seqState->prevOffset[ll0]; |  | ||||||
|                     seqState->prevOffset[1] = seqState->prevOffset[!ll0]; |  | ||||||
|                     seqState->prevOffset[0] = offset; |  | ||||||
|                 } else { |  | ||||||
|                     offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1); |  | ||||||
|                     {   size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset]; |  | ||||||
|                         temp += !temp;   /* 0 is not valid; input is corrupted; force offset to 1 */ |  | ||||||
|                         if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1]; |  | ||||||
|                         seqState->prevOffset[1] = seqState->prevOffset[0]; |  | ||||||
|                         seqState->prevOffset[0] = offset = temp; |  | ||||||
|             }   }   } |  | ||||||
|             seq.offset = offset; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (mlBits > 0) |  | ||||||
|             seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/); |  | ||||||
|  |  | ||||||
|         if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32)) |  | ||||||
|             BIT_reloadDStream(&seqState->DStream); |  | ||||||
|         if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog))) |  | ||||||
|             BIT_reloadDStream(&seqState->DStream); |  | ||||||
|         /* Ensure there are enough bits to read the rest of data in 64-bit mode. */ |  | ||||||
|         ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64); |  | ||||||
|  |  | ||||||
|         if (llBits > 0) |  | ||||||
|             seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/); |  | ||||||
|  |  | ||||||
|         if (MEM_32bits()) |  | ||||||
|             BIT_reloadDStream(&seqState->DStream); |  | ||||||
|  |  | ||||||
|         DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u", |  | ||||||
|                     (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); |  | ||||||
|  |  | ||||||
|         ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits);    /* <=  9 bits */ |  | ||||||
|         ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits);    /* <=  9 bits */ |  | ||||||
|         if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);    /* <= 18 bits */ |  | ||||||
|         ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits);  /* <=  8 bits */ |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return seq; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ZSTD_decodeSequence(): |  * ZSTD_decodeSequence(): | ||||||
|  * @p longOffsets : tells the decoder to reload more bit while decoding large offsets |  * @p longOffsets : tells the decoder to reload more bit while decoding large offsets | ||||||
| @@ -1754,11 +1632,6 @@ ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, | |||||||
|         ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); |         ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); | ||||||
|         assert(dst != NULL); |         assert(dst != NULL); | ||||||
|  |  | ||||||
|         ZSTD_STATIC_ASSERT( |  | ||||||
|             BIT_DStream_unfinished < BIT_DStream_completed && |  | ||||||
|             BIT_DStream_endOfBuffer < BIT_DStream_completed && |  | ||||||
|             BIT_DStream_completed < BIT_DStream_overflow); |  | ||||||
|  |  | ||||||
| #if defined(__GNUC__) && defined(__x86_64__) | #if defined(__GNUC__) && defined(__x86_64__) | ||||||
|             __asm__(".p2align 6"); |             __asm__(".p2align 6"); | ||||||
|             __asm__("nop"); |             __asm__("nop"); | ||||||
| @@ -1787,9 +1660,7 @@ ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         /* check if reached exact end */ |         /* check if reached exact end */ | ||||||
|         DEBUGLOG(5, "ZSTD_decompressSequences_body: after decode loop, remaining nbSeq : %i", nbSeq); |         assert(nbSeq == 0); | ||||||
|         RETURN_ERROR_IF(nbSeq, corruption_detected, ""); |  | ||||||
|         DEBUGLOG(5, "bitStream : start=%p, ptr=%p, bitsConsumed=%u", seqState.DStream.start, seqState.DStream.ptr, seqState.DStream.bitsConsumed); |  | ||||||
|         RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, ""); |         RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, ""); | ||||||
|         /* save reps for next block */ |         /* save reps for next block */ | ||||||
|         { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); } |         { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); } | ||||||
| @@ -1801,8 +1672,7 @@ ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, | |||||||
|         if (op != NULL) { |         if (op != NULL) { | ||||||
|             ZSTD_memcpy(op, litPtr, lastLLSize); |             ZSTD_memcpy(op, litPtr, lastLLSize); | ||||||
|             op += lastLLSize; |             op += lastLLSize; | ||||||
|         } |     }   } | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return op-ostart; |     return op-ostart; | ||||||
| } | } | ||||||
| @@ -1886,20 +1756,17 @@ ZSTD_decompressSequencesLong_body( | |||||||
|         ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); |         ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); | ||||||
|  |  | ||||||
|         /* prepare in advance */ |         /* prepare in advance */ | ||||||
|         for (seqNb=0; (BIT_reloadDStream(&seqState.DStream) <= BIT_DStream_completed) && (seqNb<seqAdvance); seqNb++) { |         for (seqNb=0; seqNb<seqAdvance; seqNb++) { | ||||||
|             seq_t const sequence = ZSTD_decodeSequence_old(&seqState, isLongOffset); |             seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1); | ||||||
|             prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); |             prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); | ||||||
|             sequences[seqNb] = sequence; |             sequences[seqNb] = sequence; | ||||||
|         } |         } | ||||||
|         RETURN_ERROR_IF(seqNb<seqAdvance, corruption_detected, ""); |  | ||||||
|  |  | ||||||
|         /* decompress without stomping litBuffer */ |         /* decompress without stomping litBuffer */ | ||||||
|         for (; (BIT_reloadDStream(&(seqState.DStream)) <= BIT_DStream_completed) && (seqNb < nbSeq); seqNb++) { |         for (; seqNb < nbSeq; seqNb++) { | ||||||
|             seq_t sequence = ZSTD_decodeSequence_old(&seqState, isLongOffset); |             seq_t sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1); | ||||||
|             size_t oneSeqSize; |  | ||||||
|  |  | ||||||
|             if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) |             if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) { | ||||||
|             { |  | ||||||
|                 /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */ |                 /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */ | ||||||
|                 const size_t leftoverLit = dctx->litBufferEnd - litPtr; |                 const size_t leftoverLit = dctx->litBufferEnd - litPtr; | ||||||
|                 if (leftoverLit) |                 if (leftoverLit) | ||||||
| @@ -1912,21 +1779,21 @@ ZSTD_decompressSequencesLong_body( | |||||||
|                 litPtr = dctx->litExtraBuffer; |                 litPtr = dctx->litExtraBuffer; | ||||||
|                 litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; |                 litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; | ||||||
|                 dctx->litBufferLocation = ZSTD_not_in_dst; |                 dctx->litBufferLocation = ZSTD_not_in_dst; | ||||||
|                 oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); |                 {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); | ||||||
| #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) | #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) | ||||||
|                 assert(!ZSTD_isError(oneSeqSize)); |                     assert(!ZSTD_isError(oneSeqSize)); | ||||||
|                 ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); |                     ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); | ||||||
| #endif | #endif | ||||||
|                 if (ZSTD_isError(oneSeqSize)) return oneSeqSize; |                     if (ZSTD_isError(oneSeqSize)) return oneSeqSize; | ||||||
|  |  | ||||||
|                 prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); |                     prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); | ||||||
|                 sequences[seqNb & STORED_SEQS_MASK] = sequence; |                     sequences[seqNb & STORED_SEQS_MASK] = sequence; | ||||||
|                 op += oneSeqSize; |                     op += oneSeqSize; | ||||||
|             } |             }   } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 /* lit buffer is either wholly contained in first or second split, or not split at all*/ |                 /* lit buffer is either wholly contained in first or second split, or not split at all*/ | ||||||
|                 oneSeqSize = dctx->litBufferLocation == ZSTD_split ? |                 size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ? | ||||||
|                     ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) : |                     ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) : | ||||||
|                     ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); |                     ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); | ||||||
| #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) | #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) | ||||||
| @@ -1940,17 +1807,15 @@ ZSTD_decompressSequencesLong_body( | |||||||
|                 op += oneSeqSize; |                 op += oneSeqSize; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         RETURN_ERROR_IF(seqNb<nbSeq, corruption_detected, ""); |         RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, ""); | ||||||
|  |  | ||||||
|         /* finish queue */ |         /* finish queue */ | ||||||
|         seqNb -= seqAdvance; |         seqNb -= seqAdvance; | ||||||
|         for ( ; seqNb<nbSeq ; seqNb++) { |         for ( ; seqNb<nbSeq ; seqNb++) { | ||||||
|             seq_t *sequence = &(sequences[seqNb&STORED_SEQS_MASK]); |             seq_t *sequence = &(sequences[seqNb&STORED_SEQS_MASK]); | ||||||
|             if (dctx->litBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) |             if (dctx->litBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) { | ||||||
|             { |  | ||||||
|                 const size_t leftoverLit = dctx->litBufferEnd - litPtr; |                 const size_t leftoverLit = dctx->litBufferEnd - litPtr; | ||||||
|                 if (leftoverLit) |                 if (leftoverLit) { | ||||||
|                 { |  | ||||||
|                     RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); |                     RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); | ||||||
|                     ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); |                     ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); | ||||||
|                     sequence->litLength -= leftoverLit; |                     sequence->litLength -= leftoverLit; | ||||||
| @@ -1959,8 +1824,7 @@ ZSTD_decompressSequencesLong_body( | |||||||
|                 litPtr = dctx->litExtraBuffer; |                 litPtr = dctx->litExtraBuffer; | ||||||
|                 litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; |                 litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; | ||||||
|                 dctx->litBufferLocation = ZSTD_not_in_dst; |                 dctx->litBufferLocation = ZSTD_not_in_dst; | ||||||
|                 { |                 {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); | ||||||
|                     size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); |  | ||||||
| #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) | #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) | ||||||
|                     assert(!ZSTD_isError(oneSeqSize)); |                     assert(!ZSTD_isError(oneSeqSize)); | ||||||
|                     ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); |                     ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); | ||||||
| @@ -1988,8 +1852,7 @@ ZSTD_decompressSequencesLong_body( | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* last literal segment */ |     /* last literal segment */ | ||||||
|     if (dctx->litBufferLocation == ZSTD_split)  /* first deplete literal buffer in dst, then copy litExtraBuffer */ |     if (dctx->litBufferLocation == ZSTD_split) { /* first deplete literal buffer in dst, then copy litExtraBuffer */ | ||||||
|     { |  | ||||||
|         size_t const lastLLSize = litBufferEnd - litPtr; |         size_t const lastLLSize = litBufferEnd - litPtr; | ||||||
|         RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, ""); |         RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, ""); | ||||||
|         if (op != NULL) { |         if (op != NULL) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user