Skip to content

Commit eb4cb92

Browse files
committed
check res before unpoison
1 parent 3f1e7ef commit eb4cb92

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/Support/Compression.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,14 @@ Error zstd::decompress(ArrayRef<uint8_t> Input, uint8_t *Output,
206206
const size_t Res = ::ZSTD_decompress(
207207
Output, UncompressedSize, (const uint8_t *)Input.data(), Input.size());
208208
UncompressedSize = Res;
209+
if (ZSTD_isError(Res)) {
210+
return make_error<StringError>(ZSTD_getErrorName(Res),
211+
inconvertibleErrorCode());
212+
}
209213
// Tell MemorySanitizer that zstd output buffer is fully initialized.
210214
// This avoids a false report when running LLVM with uninstrumented ZLib.
211215
__msan_unpoison(Output, UncompressedSize);
212-
return ZSTD_isError(Res) ? make_error<StringError>(ZSTD_getErrorName(Res),
213-
inconvertibleErrorCode())
214-
: Error::success();
216+
return Error::success();
215217
}
216218

217219
Error zstd::decompress(ArrayRef<uint8_t> Input,

0 commit comments

Comments
 (0)