mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-13 22:08:54 +00:00
D3D12 GPU: Prevent reading out of bounds when uploading textures.
When the upload needs realignment, a new buffer is created to do the upload, and the source data is copied to the new buffer. This commit fixes the issue where the memcopy can read off the end of the source buffer since it is reading based on destination pitch instead of source pitch.
This commit is contained in:
committed by
Sam Lantinga
parent
1fb663b429
commit
6a01d6e7d3
@@ -5941,7 +5941,7 @@ static void D3D12_UploadToTexture(
|
|||||||
SDL_memcpy(
|
SDL_memcpy(
|
||||||
temporaryBuffer->mapPointer + (sliceIndex * rowsPerSlice) + (rowIndex * alignedRowPitch),
|
temporaryBuffer->mapPointer + (sliceIndex * rowsPerSlice) + (rowIndex * alignedRowPitch),
|
||||||
transferBufferContainer->activeBuffer->mapPointer + source->offset + (sliceIndex * bytesPerSlice) + (rowIndex * rowPitch),
|
transferBufferContainer->activeBuffer->mapPointer + source->offset + (sliceIndex * bytesPerSlice) + (rowIndex * rowPitch),
|
||||||
alignedRowPitch);
|
rowPitch);
|
||||||
}
|
}
|
||||||
Uint32 offset = source->offset + (sliceIndex * bytesPerSlice) + ((rowsPerSlice - 1) * rowPitch);
|
Uint32 offset = source->offset + (sliceIndex * bytesPerSlice) + ((rowsPerSlice - 1) * rowPitch);
|
||||||
SDL_memcpy(
|
SDL_memcpy(
|
||||||
|
|||||||
Reference in New Issue
Block a user