We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1627 - signal SIGSEGV SDL_UpperBlit ()
Summary: signal SIGSEGV SDL_UpperBlit ()
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 1.2.14
Hardware: x86 Windows 7
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-23 15:21 UTC by Trent
Modified: 2014-07-08 04:43 UTC (History)
1 user (show)

See Also:


Attachments
source code (285.50 KB, application/x-tar)
2012-10-23 15:21 UTC, Trent
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Trent 2012-10-23 15:21:52 UTC
Created attachment 977 [details]
source code

This bug appear with a SDL_Surface **x; and SDL_BlitSurface x[i] on a large surface (saving a map).
Pseudo code :
SDL_Surface *srf,*x[2800];
for(i=0;i<2800;i++){
    x[i]=SDL_LoadBMP("bk.bmp");
    SDL_BlitSurface(x[i],NULL,srf,&pos);
}
SDL_SaveBMP(srf,"0.bmp");

Bug does not appear using a unique SDL_Surface *x;

SDL_Surface *srf,*x;
x=SDL_LoadBMP("bk.bmp");
for(i=0;i<2800;i++){
    SDL_BlitSurface(x,NULL,srf,&pos);
}
SDL_SaveBMP(srf,"0.bmp");

--
SDL.dll version 1.2.14
Program received signal SIGSEGV, Segmentation fault.
0x681247d8 in SDL_UpperBlit ()
   from C:\Users\Trent\test2\SDL.dll
(gdb) bt
#0  0x681247d8 in SDL_UpperBlit ()
   from C:\Users\Trent\test2\SDL.dll
#1  0x00401432 in SDL_main (argc=1, argv=0x542da0) at _debug.c:18
#2  0x004024c9 in console_main (argc=1, argv=0x542da0)
    at ./src/main/win32/SDL_win32_main.c:315
#3  0x0040258b in WinMain@16 (hInst=0x400000, hPrev=0x0,
    szCmdLine=0x723bea "", sw=10) at ./src/main/win32/SDL_win32_main.c:398
#4  0x00401bd6 in main ()
Comment 1 Sylvain 2014-06-29 09:03:44 UTC
I have checked this one.

It can be closed as the test case is bugged.

the img[] array is access out of bounds. (2704). Hence the SIGSEV.
Making img[] as 2800 solves the issue and the test case works : the large surface is correctly created.
Comment 2 Sam Lantinga 2014-07-08 04:43:34 UTC
Thanks for checking this, Sylvain!