Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fuzzers/D3D12Fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

uint64_t UInt8ToUInt64(const uint8_t* src) {
uint64_t dst;
memcpy(&dst, src, sizeof(uint64_t));
memcpy_s(&dst, sizeof(uint64_t), src, sizeof(uint8_t));
return dst;
}

Expand Down
3 changes: 2 additions & 1 deletion src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,8 @@ namespace gpgmm::d3d12 {
}
data.IsResourceAllocationWithinCoherent =
mCaps->IsResourceAllocationWithinCoherent();
memcpy(pFeatureSupportData, &data, featureSupportDataSize);
memcpy_s(pFeatureSupportData, sizeof(pFeatureSupportData), &data,
featureSupportDataSize);
return S_OK;
}
default: {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/end2end/D3D12ResourceAllocatorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,21 +1166,21 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithinMany) {
0xCC);
void* mappedBufferC = nullptr;
ASSERT_SUCCEEDED(smallBufferC->Map(/*subresource*/ 0, nullptr, &mappedBufferC));
memcpy(mappedBufferC, dataCC.data(), dataCC.size());
memcpy_s(mappedBufferC, smallBufferC->GetInfo().SizeInBytes, dataCC.data(), dataCC.size());

// Fill small buffer A with value 0xAA.
std::vector<uint8_t> dataAA(static_cast<const size_t>(smallBufferA->GetInfo().SizeInBytes),
0xAA);
void* mappedBufferA = nullptr;
ASSERT_SUCCEEDED(smallBufferA->Map(/*subresource*/ 0, nullptr, &mappedBufferA));
memcpy(mappedBufferA, dataAA.data(), dataAA.size());
memcpy_s(mappedBufferA, smallBufferA->GetInfo().SizeInBytes, dataAA.data(), dataAA.size());

// Fill small buffer B with value 0xBB.
std::vector<uint8_t> dataBB(static_cast<const size_t>(smallBufferB->GetInfo().SizeInBytes),
0xBB);
void* mappedBufferB = nullptr;
ASSERT_SUCCEEDED(smallBufferB->Map(/*subresource*/ 0, nullptr, &mappedBufferB));
memcpy(mappedBufferB, dataBB.data(), dataBB.size());
memcpy_s(mappedBufferB, smallBufferB->GetInfo().SizeInBytes, dataBB.data(), dataBB.size());

EXPECT_NE(mappedBufferA, mappedBufferB);
EXPECT_NE(mappedBufferB, mappedBufferC);
Expand Down