Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied patch to not crash on 3.2+ core profiles #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

smirgol
Copy link

@smirgol smirgol commented Apr 12, 2018

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727175

Most SOIL functions crash if OpenGL context is 3.2+ core profile. SOIL calls
glGetString with a value that is no longer valid, and then sends the returned
null pointer to strstr.

This patch checks the OpenGL version at runtime, and uses a glGetString function
that is appropriate and available. It doesn't crash if, for whatever reason,
glGetString returns a null pointer.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727175

Most SOIL functions crash if OpenGL context is 3.2+ core profile. SOIL calls
glGetString with a value that is no longer valid, and then sends the returned
null pointer to strstr.

This patch checks the OpenGL version at runtime, and uses a glGetString function
that is appropriate and available. It doesn't crash if, for whatever reason,
glGetString returns a null pointer.
@kbranigan
Copy link
Owner

Hey thanks! I'm curious, but why are the files are severely different? It seems like you've changed a heck of a lot more then just glGetString

@smirgol
Copy link
Author

smirgol commented Apr 12, 2018

Uhm, that's a good question. All I added were the changes from the patch you can find in the bugreport I've linked above, along with a comment that it was patched and where I did get the patch from.
Somehow the diff thinks I've changed everything? Might be due to line-endings (I'm on linux), don't know - it's my first pull request ever. :)

@smirgol
Copy link
Author

smirgol commented Apr 12, 2018

Yep, line-endings. I've changed them back to windows-style. By doing that I've accidentially commited a codeblocks file, which I've then deleted. Here's a patch with the changes only, in case you cannot use the pull request:
fix_glGetString_crash.txt

@smirgol
Copy link
Author

smirgol commented Apr 12, 2018

Thinking about the changes, it likely won't work on windows and maybe mac due to the usage of glXGetProcAddressARB. Maybe the SOIL_internal_has_OGL_capability function could be improved by using parts of njcrawford's code. Can't test that for windows and mac unfortunately.

@kbranigan
Copy link
Owner

I can test it on mac and windows if it's in a state you think it'd work, but unfortunately I'm not familiar with OpenGL 3.2+

RaZeR-RBI added a commit to RaZeR-RBI/soil that referenced this pull request Jan 3, 2019
Lecrapouille added a commit to Lecrapouille/SOIL that referenced this pull request Nov 4, 2022
Lecrapouille added a commit to Lecrapouille/SOIL that referenced this pull request Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants