Bug 51641 - GLU_TESS_COMBINE callback called with NULL data pointers, conflicting documentation.
Summary: GLU_TESS_COMBINE callback called with NULL data pointers, conflicting documen...
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLU (show other bugs)
Version: 8.0
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-01 18:51 UTC by Carl Chatfield
Modified: 2019-05-13 16:11 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Carl Chatfield 2012-07-01 18:51:32 UTC
According to http://www.opengl.org/sdk/docs/man/xhtml/gluTessCallback.xml (don't know if this is official or not.):

void combine( GLdouble coords[3], void *vertex_data[4], 
              GLfloat weight[4], void **outData );
                        
All vertex pointers are valid even when some of the weights are 0. coords gives the location of the new vertex.

The following example code is also given:
void myCombine( GLdouble coords[3], VERTEX *d[4],
                GLfloat w[4], VERTEX **dataOut )
{
   VERTEX *new = new_vertex();

   new->x = coords[0];
   new->y = coords[1];
   new->z = coords[2];
   new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r;
   new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g;
   new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b;
   new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a;
   *dataOut = new;
}

Implying that all vertex pointers are indeed valid.

However, in the function

static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1,
				 GLUhalfEdge *e2 )
/*
 * Two vertices with idential coordinates are combined into one.
 * e1->Org is kept, while e2->Org is discarded.
 */
{
  void *data[4] = { NULL, NULL, NULL, NULL };
  GLfloat weights[4] = { 0.5, 0.5, 0.0, 0.0 };

  data[0] = e1->Org->data;
  data[1] = e2->Org->data;
  CallCombine( tess, e1->Org, data, weights, FALSE );
  if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1);
}

data[3] and data[4] are NULL. Thus if an application expects the pointers to be valid, they will crash.

A possible fix:

  data[0] = data[2] = e1->Org->data;
  data[1] = data[3] = e2->Org->data;
Comment 1 GitLab Migration User 2019-05-13 16:11:35 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/glu/issues/1.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.