diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 0a29f03d4..c2d1f633a 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -742,7 +742,7 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* */ for (stream = 1; stream < 4; ++stream) { if (ip[stream] < ip[stream - 1]) - break; + goto _out; } } @@ -775,6 +775,8 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* } while (op[3] < olimit); } +_out: + /* Save the final values of each of the state variables back to args. */ ZSTD_memcpy(&args->bits, &bits, sizeof(bits)); ZSTD_memcpy(&args->ip, &ip, sizeof(ip)); @@ -1535,7 +1537,7 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* */ for (stream = 1; stream < 4; ++stream) { if (ip[stream] < ip[stream - 1]) - break; + goto _out; } } @@ -1593,6 +1595,8 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* } while (op[3] < olimit); } +_out: + /* Save the final values of each of the state variables back to args. */ ZSTD_memcpy(&args->bits, &bits, sizeof(bits)); ZSTD_memcpy(&args->ip, &ip, sizeof(ip));