mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed crash if the input data pitch is larger than the locked texture pitch
This commit is contained in:
parent
b420ad0e01
commit
8db4c5a9d3
@ -1009,6 +1009,12 @@ D3D_UpdateTextureInternal(IDirect3DTexture9 *texture, Uint32 format, SDL_bool fu
|
|||||||
if (length == pitch && length == locked.Pitch) {
|
if (length == pitch && length == locked.Pitch) {
|
||||||
SDL_memcpy(dst, src, length*h);
|
SDL_memcpy(dst, src, length*h);
|
||||||
} else {
|
} else {
|
||||||
|
if (length > pitch) {
|
||||||
|
length = pitch;
|
||||||
|
}
|
||||||
|
if (length > locked.Pitch) {
|
||||||
|
length = locked.Pitch;
|
||||||
|
}
|
||||||
for (row = 0; row < h; ++row) {
|
for (row = 0; row < h; ++row) {
|
||||||
SDL_memcpy(dst, src, length);
|
SDL_memcpy(dst, src, length);
|
||||||
src += pitch;
|
src += pitch;
|
||||||
|
Loading…
Reference in New Issue
Block a user