Fix ASAN heap-buffer-overflow in PixTests (#5974)
PixStructAnnotation tests were converting an IDxcBlobEncoding to a std::string, but this isn't valid if the underlying object is an InternalDxcBlobEncoding_Impl, which holds a buffer that may not be null-terminated. Fix this by using the BlobToUtf8 helper, which handles this case gracefully. Fixes 23 ASAN failures.
This commit is contained in:
Родитель
620c29d278
Коммит
519dd5bd56
|
@ -258,10 +258,7 @@ PassOutput RunAnnotationPasses(dxc::DxcDllSupport &dllSupport, IDxcBlob *dxil,
|
|||
VERIFY_SUCCEEDED(pOptimizer->RunOptimizer(
|
||||
dxil, Options.data(), Options.size(), &pOptimizedModule, &pText));
|
||||
|
||||
std::string outputText;
|
||||
if (pText->GetBufferSize() != 0) {
|
||||
outputText = reinterpret_cast<const char *>(pText->GetBufferPointer());
|
||||
}
|
||||
std::string outputText = BlobToUtf8(pText);
|
||||
|
||||
auto disasm = ToString(Disassemble(dllSupport, pOptimizedModule));
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче