[Mesa-dev] [PATCH 3/3] mesa: Remove extra NULL Check on glFeedbackBuffer().

Brian Paul brian.e.paul at gmail.com
Tue Jun 28 20:20:14 PDT 2011


On Tue, Jun 28, 2011 at 5:49 PM, Eric Anholt <eric at anholt.net> wrote:
> This error result doesn't appear in the GL 2.1 or 3.2 compatibility
> specs, and triggers an unexpected GL error in Intel's oglconform when
> it tries to reset the feedback state after usage so that the "diff the
> state at error time vs. context init time" code doesn't generate
> spurious diffs.  The unexpected GL error then translates into testcase
> failure.
> ---
>  src/mesa/main/feedback.c |    5 -----
>  1 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
> index fcb089f..f4862f5 100644
> --- a/src/mesa/main/feedback.c
> +++ b/src/mesa/main/feedback.c
> @@ -64,11 +64,6 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
>       _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(size<0)" );
>       return;
>    }
> -   if (!buffer) {
> -      _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" );
> -      ctx->Feedback.BufferSize = 0;
> -      return;
> -   }
>
>    switch (type) {
>       case GL_2D:

You're removing the null ptr check which set the buffer size to zero.
What if someone passes buffer=NULL but size > 0?  I hope we don't
crash now if we didn't crash before.  Though, I doubt that'd ever
happen in practice.

-Brian


More information about the mesa-dev mailing list