Fixed bug 3541 - DisplayIndex out of bounds in SDL_SetWindowPosition
authorSam Lantinga <slouken@libsdl.org>
Sat, 31 Dec 2016 10:30:07 -0800
changeset 10732617f3de85b0a
parent 10731 fe1e3dfa67ef
child 10733 5f8d2376d5b2
Fixed bug 3541 - DisplayIndex out of bounds in SDL_SetWindowPosition


Intellectual Kitty

In SDL_video.c, on line #1756, in SDL_SetWindowPosition (from today's distribution, 12-31-2016, https://hg.libsdl.org/SDL/shortlog/fe1e3dfa67ef):

if (displayIndex > _this->num_displays) {

should be:

if (displayIndex >= _this->num_displays) {
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Fri Dec 30 19:57:50 2016 +0100
     1.2 +++ b/src/video/SDL_video.c	Sat Dec 31 10:30:07 2016 -0800
     1.3 @@ -1753,7 +1753,7 @@
     1.4      if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
     1.5          int displayIndex = (x & 0xFFFF);
     1.6          SDL_Rect bounds;
     1.7 -        if (displayIndex > _this->num_displays) {
     1.8 +        if (displayIndex >= _this->num_displays) {
     1.9              displayIndex = 0;
    1.10          }
    1.11