]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed huff0 decoder (32-bits mode)
authorYann Collet <yann.collet.73@gmail.com>
Sat, 28 Nov 2015 21:03:08 +0000 (22:03 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Sat, 28 Nov 2015 21:03:08 +0000 (22:03 +0100)
lib/huff0.c

index a8798fd716fb9ee48b3dcfaa6d509c692b888e62..3ddb7e5e3652952875bd34d80dfc3f33559be5af 100644 (file)
@@ -1495,10 +1495,7 @@ static inline size_t HUF_decodeStreamX6(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* c
     while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-4))
         HUF_DECODE_SYMBOLX6_0(p, bitDPtr);
 
-    while (p <= pEnd-4)
-        HUF_DECODE_SYMBOLX6_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
-
-    while (p < pEnd)
+    while ((BIT_reloadDStream(bitDPtr) <= BIT_DStream_endOfBuffer) && (p < pEnd))
         p += HUF_decodeLastSymbolsX6(p, (U32)(pEnd-p), bitDPtr, dd, ds, dtLog);
 
     return p-pStart;