src/render/direct3d/SDL_render_d3d.c
changeset 8255 49af9be342cd
parent 8228 010ae1267485
child 8590 6e6bd53feff0
--- a/src/render/direct3d/SDL_render_d3d.c	Mon Feb 24 23:09:35 2014 -0800
+++ b/src/render/direct3d/SDL_render_d3d.c	Tue Feb 25 10:04:49 2014 -0800
@@ -1009,6 +1009,12 @@
     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;