Segfault on SDL_GL_SetAttribute

Hi,

I’ve been trying to robust-icize my code, so I’m running it on many different machines. All all Linux boxes I’ve run it on, I get an “Invalid write of size 4” with Valgrind caused by SDL_GL_SetAttribute.

My program sets various parameters, so SDL_GL_SetAttribute is called several times, so there are several such invalid writes. It should be noted that this happens before SDL_SetVideoMode(…) and after SDL_Init(SDL_INIT_EVERYTHING).

On one of the boxes I’ve tried, the program segfaults due to the second such invalid write.

I found nothing on the internet. Help?
Thanks,
Ian

What version of SDL are you using?On Wed, Mar 21, 2012 at 4:46 PM, Geometrian wrote:

**
Hi,

I’ve been trying to robust-icize my code, so I’m running it on many
different machines. All all Linux boxes I’ve run it on, I get an “Invalid
write of size 4” with Valgrind caused by SDL_GL_SetAttribute.

My program sets various parameters, so SDL_GL_SetAttribute is called
several times, so there are several such invalid writes. It should be noted
that this happens before SDL_SetVideoMode(…) and afterSDL_Init(SDL_INIT_EVERYTHING).

On one of the boxes I’ve tried, the program segfaults due to the second
such invalid write.

I found nothing on the internet. Help?
Thanks,
Ian


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Patrick Baggett wrote:

What version of SDL are you using?
1.2.15

Please display some info from Valgrind. Here’s what I can see from the
source:

SDL_Init() -> SDL_InitSubSystem() -> SDL_VideoInit() -> sets up the global
variable SDL_Video* current_video.

SDL_Get_SetAttribute() sets video->gl_config., e.g.
“video->gl_config.green_size”

In order to get invalid writes, “video” would need to point to
something bad (but then it might crash?)

Can you reduce the error to an absolutely* *minimal example, e.g:

int main() {

SDL_Init(SDL_INIT_VIDEO);


SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);

}On Thu, Mar 29, 2012 at 6:17 PM, Geometrian wrote:

**

Patrick Baggett wrote:

What version of SDL are you using?

1.2.15


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org