Skip to content

Commit

Permalink
Fixed crash if the input data pitch is larger than the locked texture…
Browse files Browse the repository at this point in the history
… pitch
  • Loading branch information
slouken committed Feb 25, 2014
1 parent b420ad0 commit 8db4c5a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/render/direct3d/SDL_render_d3d.c
Expand Up @@ -1009,6 +1009,12 @@ D3D_UpdateTextureInternal(IDirect3DTexture9 *texture, Uint32 format, SDL_bool fu
if (length == pitch && length == locked.Pitch) {
SDL_memcpy(dst, src, length*h);
} else {
if (length > pitch) {
length = pitch;
}
if (length > locked.Pitch) {
length = locked.Pitch;
}
for (row = 0; row < h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
Expand Down

0 comments on commit 8db4c5a

Please sign in to comment.