[Mesa-dev] [PATCH] mesa: add missing error check in _mesa_CallLists()
Generate GL_INVALID_VALUE if n < 0. Return early if n==0. --- src/mesa/main/dlist.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cd8e3b6..24aea35 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9105,6 +9105,15 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) return; } + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)"); + return; + } + else if (n == 0) { + /* nothing to do */ + return; + } + /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: add missing error check in _mesa_CallLists()
On 02/08/2016 02:31 PM, Brian Paul wrote: > Generate GL_INVALID_VALUE if n < 0. Return early if n==0. > --- > src/mesa/main/dlist.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c > index cd8e3b6..24aea35 100644 > --- a/src/mesa/main/dlist.c > +++ b/src/mesa/main/dlist.c > @@ -9105,6 +9105,15 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * > lists) >return; > } > > + if (n < 0) { > + _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)"); > + return; > + } > + else if (n == 0) { I think the modern style is to put the 'else if' on the same line with the closing curly brace. I'm not too picky about it since this matches all the rest of dlist.c. I'm also wondering... should this check go before the call to SAVE_FLUSH_VERTICES? Usually we try to bail from errors before doing anything. > + /* nothing to do */ > + return; > + } > + > /* Save the CompileFlag status, turn it off, execute display list, > * and restore the CompileFlag. > */ > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: add missing error check in _mesa_CallLists()
On 02/08/2016 05:07 PM, Ian Romanick wrote: On 02/08/2016 02:31 PM, Brian Paul wrote: Generate GL_INVALID_VALUE if n < 0. Return early if n==0. --- src/mesa/main/dlist.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cd8e3b6..24aea35 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9105,6 +9105,15 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) return; } + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)"); + return; + } + else if (n == 0) { I think the modern style is to put the 'else if' on the same line with the closing curly brace. I'm not too picky about it since this matches all the rest of dlist.c. I can change it before pushing. I'm also wondering... should this check go before the call to SAVE_FLUSH_VERTICES? Usually we try to bail from errors before doing anything. I don't see a call to SAVE_FLUSH_VERTICES() in _mesa_CallLists(). I think you're looking at save_CallLists(). R-b otherwise? -Brian + /* nothing to do */ + return; + } + /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. */ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: add missing error check in _mesa_CallLists()
Generate GL_INVALID_VALUE if n < 0. Return early if n==0 or lists==NULL. v2: fix formatting, also check for lists==NULL. --- src/mesa/main/dlist.c | 8 1 file changed, 8 insertions(+) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cd8e3b6..65f0929 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9105,6 +9105,14 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) return; } + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)"); + return; + } else if (n == 0 || lists == NULL) { + /* nothing to do */ + return; + } + /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: add missing error check in _mesa_CallLists()
On 02/08/2016 05:06 PM, Brian Paul wrote: > Generate GL_INVALID_VALUE if n < 0. Return early if n==0 or lists==NULL. > > v2: fix formatting, also check for lists==NULL. You were correct that I was looking at save_CallLists before. Reviewed-by: Ian Romanick> --- > src/mesa/main/dlist.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c > index cd8e3b6..65f0929 100644 > --- a/src/mesa/main/dlist.c > +++ b/src/mesa/main/dlist.c > @@ -9105,6 +9105,14 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * > lists) >return; > } > > + if (n < 0) { > + _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)"); > + return; > + } else if (n == 0 || lists == NULL) { > + /* nothing to do */ > + return; > + } > + > /* Save the CompileFlag status, turn it off, execute display list, > * and restore the CompileFlag. > */ > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev