Skip to content

Commit 9419b9b

Browse files
authored
Fix UBSAN error in DxilRootSignatureSerializer (microsoft#5795)
Fix UBSAN error: ``` lib/DxilRootSignature/DxilRootSignatureSerializer.cpp:134:5: runtime error: store to misaligned address 0x7fff812daf5f for type 'unsigned int', which requires 4 byte alignment ``` Use memcpy to write to unaligned address. Fixes 63 of these reported from running check-all.
1 parent 4c9ca1b commit 9419b9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/DxilRootSignature/DxilRootSignatureSerializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ HRESULT SimpleSerializer::ReserveBlock(void **ppData, unsigned cbSize,
131131

132132
*ppData = pClonedData;
133133
if (pOffset) {
134-
*pOffset = pSegment->Offset;
134+
memcpy(pOffset, &pSegment->Offset, sizeof(pSegment->Offset));
135135
}
136136

137137
Cleanup:

0 commit comments

Comments
 (0)