Fixed crash if the input data pitch is larger than the locked texture pitch
authorSam Lantinga <slouken@libsdl.org>
Tue, 25 Feb 2014 10:04:49 -0800
changeset 825549af9be342cd
parent 8254 f97b5166c158
child 8256 bcfb214c2950
Fixed crash if the input data pitch is larger than the locked texture pitch
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Mon Feb 24 23:09:35 2014 -0800
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Tue Feb 25 10:04:49 2014 -0800
     1.3 @@ -1009,6 +1009,12 @@
     1.4      if (length == pitch && length == locked.Pitch) {
     1.5          SDL_memcpy(dst, src, length*h);
     1.6      } else {
     1.7 +        if (length > pitch) {
     1.8 +            length = pitch;
     1.9 +        }
    1.10 +        if (length > locked.Pitch) {
    1.11 +            length = locked.Pitch;
    1.12 +        }
    1.13          for (row = 0; row < h; ++row) {
    1.14              SDL_memcpy(dst, src, length);
    1.15              src += pitch;