1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibGL: Reject GL_LEFT and GL_RIGHT in glCullFace

glCullFace only accepts GL_FRONT, GL_BACK and GL_FRONT_AND_BACK.
We checked if the mode was valid by performing
```
cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK
```

However, this range also contains GL_LEFT and GL_RIGHT, which we would
accept when we should return a GL_INVALID_ENUM error.
This commit is contained in:
Luke Wilde 2022-06-04 00:19:15 +01:00 committed by Linus Groh
parent 2a171dfc38
commit 971d6ce16f
2 changed files with 14 additions and 1 deletions

View file

@ -243,7 +243,7 @@ void GLContext::gl_cull_face(GLenum cull_mode)
{
APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_cull_face, cull_mode);
RETURN_WITH_ERROR_IF(cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK, GL_INVALID_ENUM);
RETURN_WITH_ERROR_IF(cull_mode != GL_FRONT && cull_mode != GL_BACK && cull_mode != GL_FRONT_AND_BACK, GL_INVALID_ENUM);
m_culled_sides = cull_mode;