| Summary: | patch for small invalid read in opengles | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain <sylvain.becker> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | philipp.wiesemann |
| Version: | HG 2.1 | Keywords: | target-2.0.4, triage-2.0.4 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though! (sorry if you get a lot of copies of this email, I'm marking several bugs at once) Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship. (Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.) --ryan. This is fixed in https://hg.libsdl.org/SDL/rev/26a7259520cd (I moved the test for glGetIntegerv() down to where it is actually used). We'll likely need to fix this properly for actually getting those attributes at some point, but this is good enough for now. --ryan. |
I have this one (on linux with GLES 1) : ==4218== Conditional jump or move depends on uninitialised value(s) ==4218== at 0x4F58EAE: SDL_GL_SetAttribute_REAL (SDL_video.c:2715) ==4218== by 0x4EBF113: GLES_CreateRenderer (SDL_render_gles.c:415) ==4218== by 0x4EADA7D: SDL_CreateRenderer_REAL (SDL_render.c:272) which is : GLES_CreateRenderer ... 412 error: 413 if (changed_window) { 414 /* Uh oh, better try to put it back... */ 415 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile_mask); 416 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major); 417 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor); But the "SDL_GL_GetAttribute" has previously failed because no "glGetIntegerv". so "int profile_mask, major, minor;" are not initialized. int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) { #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); GLenum(APIENTRY * glGetErrorFunc) (void); GLenum attrib = 0; GLenum error = 0; glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); if (!glGetIntegervFunc) { printf("No glGetIntegerv!\n"); // This occured ! return -1; } Then, the creation of the renderer also failed, so putting back the values is performed with uninitialized memory. Solution: ======== easy: ==== initialize : int profile_mask, major, minor; better: ====== Add a flag : SDL_bool attributes_retrieved = SDL_FALSE; check for "SDL_GL_GetAttribute" being not -1 and in err: if (changed_window && attributes_retrieved) And also better : ================= Inside "SDL_GL_GetAttribute", move the SDL_GL_GetProcAddress("glGetIntegerv"); where is it actually required ! (this is not required to have profile_mask, major, minor)