[Mesa-dev] [PATCH 3/3] mesa: Remove extra NULL Check on glFeedbackBuffer().
Eric Anholt
eric at anholt.net
Wed Jun 29 08:22:27 PDT 2011
On Tue, 28 Jun 2011 21:20:14 -0600, Brian Paul <brian.e.paul at gmail.com> wrote:
> 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.
I'm sure we would, and I'd just chalk it up to application bugs like so
many other entrypoints with a pointer==NULL. I guess we can just limit
the check to size != NULL if you'd like.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110629/cccebce7/attachment.pgp>
More information about the mesa-dev
mailing list