idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
11,300 | SProcRenderColorTrapezoids (ClientPtr client)
{
return BadImplementation;
}
| DoS | 0 | SProcRenderColorTrapezoids (ClientPtr client)
{
return BadImplementation;
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,301 | SProcRenderColorTriangles (ClientPtr client)
{
return BadImplementation;
}
| DoS | 0 | SProcRenderColorTriangles (ClientPtr client)
{
return BadImplementation;
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,302 | SProcRenderComposite (ClientPtr client)
{
register int n;
REQUEST(xRenderCompositeReq);
swaps(&stuff->length, n);
swapl(&stuff->src, n);
swapl(&stuff->mask, n);
swapl(&stuff->dst, n);
swaps(&stuff->xSrc, n);
swaps(&stuff->ySrc, n);
swaps(&stuff->xMask, n);
swaps(&stuff->yMask, n);
swaps(&stuff->xDst, n);
swaps(&stuff->yDst, n);
swaps(&stuff->width, n);
swaps(&stuff->height, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderComposite (ClientPtr client)
{
register int n;
REQUEST(xRenderCompositeReq);
swaps(&stuff->length, n);
swapl(&stuff->src, n);
swapl(&stuff->mask, n);
swapl(&stuff->dst, n);
swaps(&stuff->xSrc, n);
swaps(&stuff->ySrc, n);
swaps(&stuff->xMask, n);
swaps(&stuff->yMask, n);
swaps(&stuff->xDst, n);
swaps(&stuff->yDst, n);
swaps(&stuff->width, n);
swaps(&stuff->height, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,303 | SProcRenderCompositeGlyphs (ClientPtr client)
{
register int n;
xGlyphElt *elt;
CARD8 *buffer;
CARD8 *end;
int space;
int i;
int size;
REQUEST(xRenderCompositeGlyphsReq);
switch (stuff->renderReqType) {
default: size = 1; break;
case X_RenderCompositeGlyphs16: size = 2; break;
case X_RenderCompositeGlyphs32: size = 4; break;
}
swaps(&stuff->length, n);
swapl(&stuff->src, n);
swapl(&stuff->dst, n);
swapl(&stuff->maskFormat, n);
swapl(&stuff->glyphset, n);
swaps(&stuff->xSrc, n);
swaps(&stuff->ySrc, n);
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
while (buffer + sizeof (xGlyphElt) < end)
{
elt = (xGlyphElt *) buffer;
buffer += sizeof (xGlyphElt);
swaps (&elt->deltax, n);
swaps (&elt->deltay, n);
i = elt->len;
if (i == 0xff)
{
swapl (buffer, n);
buffer += 4;
}
else
{
space = size * i;
switch (size) {
case 1:
buffer += i;
break;
case 2:
while (i--)
{
swaps (buffer, n);
buffer += 2;
}
break;
case 4:
while (i--)
{
swapl (buffer, n);
buffer += 4;
}
break;
}
if (space & 3)
buffer += 4 - (space & 3);
}
}
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCompositeGlyphs (ClientPtr client)
{
register int n;
xGlyphElt *elt;
CARD8 *buffer;
CARD8 *end;
int space;
int i;
int size;
REQUEST(xRenderCompositeGlyphsReq);
switch (stuff->renderReqType) {
default: size = 1; break;
case X_RenderCompositeGlyphs16: size = 2; break;
case X_RenderCompositeGlyphs32: size = 4; break;
}
swaps(&stuff->length, n);
swapl(&stuff->src, n);
swapl(&stuff->dst, n);
swapl(&stuff->maskFormat, n);
swapl(&stuff->glyphset, n);
swaps(&stuff->xSrc, n);
swaps(&stuff->ySrc, n);
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
while (buffer + sizeof (xGlyphElt) < end)
{
elt = (xGlyphElt *) buffer;
buffer += sizeof (xGlyphElt);
swaps (&elt->deltax, n);
swaps (&elt->deltay, n);
i = elt->len;
if (i == 0xff)
{
swapl (buffer, n);
buffer += 4;
}
else
{
space = size * i;
switch (size) {
case 1:
buffer += i;
break;
case 2:
while (i--)
{
swaps (buffer, n);
buffer += 2;
}
break;
case 4:
while (i--)
{
swapl (buffer, n);
buffer += 4;
}
break;
}
if (space & 3)
buffer += 4 - (space & 3);
}
}
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,304 | SProcRenderCreateAnimCursor (ClientPtr client)
{
register int n;
REQUEST (xRenderCreateAnimCursorReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq);
swaps(&stuff->length, n);
swapl(&stuff->cid, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateAnimCursor (ClientPtr client)
{
register int n;
REQUEST (xRenderCreateAnimCursorReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq);
swaps(&stuff->length, n);
swapl(&stuff->cid, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,305 | SProcRenderCreateConicalGradient (ClientPtr client)
{
register int n;
int len;
REQUEST (xRenderCreateConicalGradientReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->center.x, n);
swapl(&stuff->center.y, n);
swapl(&stuff->angle, n);
swapl(&stuff->nStops, n);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
swapStops(stuff+1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateConicalGradient (ClientPtr client)
{
register int n;
int len;
REQUEST (xRenderCreateConicalGradientReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->center.x, n);
swapl(&stuff->center.y, n);
swapl(&stuff->angle, n);
swapl(&stuff->nStops, n);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
swapStops(stuff+1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,306 | SProcRenderCreateCursor (ClientPtr client)
{
register int n;
REQUEST(xRenderCreateCursorReq);
REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
swaps(&stuff->length, n);
swapl(&stuff->cid, n);
swapl(&stuff->src, n);
swaps(&stuff->x, n);
swaps(&stuff->y, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateCursor (ClientPtr client)
{
register int n;
REQUEST(xRenderCreateCursorReq);
REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
swaps(&stuff->length, n);
swapl(&stuff->cid, n);
swapl(&stuff->src, n);
swaps(&stuff->x, n);
swaps(&stuff->y, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,307 | SProcRenderCreateGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderCreateGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->gsid, n);
swapl(&stuff->format, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderCreateGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->gsid, n);
swapl(&stuff->format, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,308 | SProcRenderCreateLinearGradient (ClientPtr client)
{
register int n;
int len;
REQUEST (xRenderCreateLinearGradientReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->p1.x, n);
swapl(&stuff->p1.y, n);
swapl(&stuff->p2.x, n);
swapl(&stuff->p2.y, n);
swapl(&stuff->nStops, n);
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
swapStops(stuff+1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateLinearGradient (ClientPtr client)
{
register int n;
int len;
REQUEST (xRenderCreateLinearGradientReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->p1.x, n);
swapl(&stuff->p1.y, n);
swapl(&stuff->p2.x, n);
swapl(&stuff->p2.y, n);
swapl(&stuff->nStops, n);
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
swapStops(stuff+1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,309 | SProcRenderCreatePicture (ClientPtr client)
{
register int n;
REQUEST(xRenderCreatePictureReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->drawable, n);
swapl(&stuff->format, n);
swapl(&stuff->mask, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreatePicture (ClientPtr client)
{
register int n;
REQUEST(xRenderCreatePictureReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->drawable, n);
swapl(&stuff->format, n);
swapl(&stuff->mask, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,310 | SProcRenderCreateRadialGradient (ClientPtr client)
{
register int n;
int len;
REQUEST (xRenderCreateRadialGradientReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->inner.x, n);
swapl(&stuff->inner.y, n);
swapl(&stuff->outer.x, n);
swapl(&stuff->outer.y, n);
swapl(&stuff->inner_radius, n);
swapl(&stuff->outer_radius, n);
swapl(&stuff->nStops, n);
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
swapStops(stuff+1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateRadialGradient (ClientPtr client)
{
register int n;
int len;
REQUEST (xRenderCreateRadialGradientReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swapl(&stuff->inner.x, n);
swapl(&stuff->inner.y, n);
swapl(&stuff->outer.x, n);
swapl(&stuff->outer.y, n);
swapl(&stuff->inner_radius, n);
swapl(&stuff->outer_radius, n);
swapl(&stuff->nStops, n);
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
swapStops(stuff+1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,311 | SProcRenderCreateSolidFill(ClientPtr client)
{
register int n;
REQUEST (xRenderCreateSolidFillReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swaps(&stuff->color.alpha, n);
swaps(&stuff->color.red, n);
swaps(&stuff->color.green, n);
swaps(&stuff->color.blue, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderCreateSolidFill(ClientPtr client)
{
register int n;
REQUEST (xRenderCreateSolidFillReq);
REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq);
swaps(&stuff->length, n);
swapl(&stuff->pid, n);
swaps(&stuff->color.alpha, n);
swaps(&stuff->color.red, n);
swaps(&stuff->color.green, n);
swaps(&stuff->color.blue, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,312 | SProcRenderDispatch (ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < RenderNumberRequests)
return (*SProcRenderVector[stuff->data]) (client);
else
return BadRequest;
}
| DoS | 0 | SProcRenderDispatch (ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < RenderNumberRequests)
return (*SProcRenderVector[stuff->data]) (client);
else
return BadRequest;
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,313 | SProcRenderFillRectangles (ClientPtr client)
{
register int n;
REQUEST(xRenderFillRectanglesReq);
REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
swaps(&stuff->length, n);
swapl(&stuff->dst, n);
swaps(&stuff->color.red, n);
swaps(&stuff->color.green, n);
swaps(&stuff->color.blue, n);
swaps(&stuff->color.alpha, n);
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderFillRectangles (ClientPtr client)
{
register int n;
REQUEST(xRenderFillRectanglesReq);
REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
swaps(&stuff->length, n);
swapl(&stuff->dst, n);
swaps(&stuff->color.red, n);
swaps(&stuff->color.green, n);
swaps(&stuff->color.blue, n);
swaps(&stuff->color.alpha, n);
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,314 | SProcRenderFreeGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderFreeGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->glyphset, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderFreeGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderFreeGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->glyphset, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,315 | SProcRenderFreePicture (ClientPtr client)
{
register int n;
REQUEST(xRenderFreePictureReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderFreePicture (ClientPtr client)
{
register int n;
REQUEST(xRenderFreePictureReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,316 | SProcRenderQueryDithers (ClientPtr client)
{
return BadImplementation;
}
| DoS | 0 | SProcRenderQueryDithers (ClientPtr client)
{
return BadImplementation;
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,317 | SProcRenderQueryFilters (ClientPtr client)
{
register int n;
REQUEST (xRenderQueryFiltersReq);
REQUEST_SIZE_MATCH (xRenderQueryFiltersReq);
swaps(&stuff->length, n);
swapl(&stuff->drawable, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderQueryFilters (ClientPtr client)
{
register int n;
REQUEST (xRenderQueryFiltersReq);
REQUEST_SIZE_MATCH (xRenderQueryFiltersReq);
swaps(&stuff->length, n);
swapl(&stuff->drawable, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,318 | SProcRenderQueryPictFormats (ClientPtr client)
{
register int n;
REQUEST(xRenderQueryPictFormatsReq);
swaps(&stuff->length, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderQueryPictFormats (ClientPtr client)
{
register int n;
REQUEST(xRenderQueryPictFormatsReq);
swaps(&stuff->length, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,319 | SProcRenderQueryPictIndexValues (ClientPtr client)
{
register int n;
REQUEST(xRenderQueryPictIndexValuesReq);
swaps(&stuff->length, n);
swapl(&stuff->format, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderQueryPictIndexValues (ClientPtr client)
{
register int n;
REQUEST(xRenderQueryPictIndexValuesReq);
swaps(&stuff->length, n);
swapl(&stuff->format, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,320 | SProcRenderQueryVersion (ClientPtr client)
{
register int n;
REQUEST(xRenderQueryVersionReq);
swaps(&stuff->length, n);
swapl(&stuff->majorVersion, n);
swapl(&stuff->minorVersion, n);
return (*ProcRenderVector[stuff->renderReqType])(client);
}
| DoS | 0 | SProcRenderQueryVersion (ClientPtr client)
{
register int n;
REQUEST(xRenderQueryVersionReq);
swaps(&stuff->length, n);
swapl(&stuff->majorVersion, n);
swapl(&stuff->minorVersion, n);
return (*ProcRenderVector[stuff->renderReqType])(client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,321 | SProcRenderReferenceGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderReferenceGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->gsid, n);
swapl(&stuff->existing, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderReferenceGlyphSet (ClientPtr client)
{
register int n;
REQUEST(xRenderReferenceGlyphSetReq);
swaps(&stuff->length, n);
swapl(&stuff->gsid, n);
swapl(&stuff->existing, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,322 | SProcRenderSetPictureClipRectangles (ClientPtr client)
{
register int n;
REQUEST(xRenderSetPictureClipRectanglesReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swaps(&stuff->xOrigin, n);
swaps(&stuff->yOrigin, n);
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderSetPictureClipRectangles (ClientPtr client)
{
register int n;
REQUEST(xRenderSetPictureClipRectanglesReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swaps(&stuff->xOrigin, n);
swaps(&stuff->yOrigin, n);
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,323 | SProcRenderSetPictureFilter (ClientPtr client)
{
register int n;
REQUEST (xRenderSetPictureFilterReq);
REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swaps(&stuff->nbytes, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderSetPictureFilter (ClientPtr client)
{
register int n;
REQUEST (xRenderSetPictureFilterReq);
REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swaps(&stuff->nbytes, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,324 | SProcRenderSetPictureTransform (ClientPtr client)
{
register int n;
REQUEST(xRenderSetPictureTransformReq);
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swapl(&stuff->transform.matrix11, n);
swapl(&stuff->transform.matrix12, n);
swapl(&stuff->transform.matrix13, n);
swapl(&stuff->transform.matrix21, n);
swapl(&stuff->transform.matrix22, n);
swapl(&stuff->transform.matrix23, n);
swapl(&stuff->transform.matrix31, n);
swapl(&stuff->transform.matrix32, n);
swapl(&stuff->transform.matrix33, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderSetPictureTransform (ClientPtr client)
{
register int n;
REQUEST(xRenderSetPictureTransformReq);
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swapl(&stuff->transform.matrix11, n);
swapl(&stuff->transform.matrix12, n);
swapl(&stuff->transform.matrix13, n);
swapl(&stuff->transform.matrix21, n);
swapl(&stuff->transform.matrix22, n);
swapl(&stuff->transform.matrix23, n);
swapl(&stuff->transform.matrix31, n);
swapl(&stuff->transform.matrix32, n);
swapl(&stuff->transform.matrix33, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,325 | SProcRenderTransform (ClientPtr client)
{
return BadImplementation;
}
| DoS | 0 | SProcRenderTransform (ClientPtr client)
{
return BadImplementation;
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,326 | SProcRenderTrapezoids (ClientPtr client)
{
register int n;
REQUEST(xRenderTrapezoidsReq);
REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
swaps (&stuff->length, n);
swapl (&stuff->src, n);
swapl (&stuff->dst, n);
swapl (&stuff->maskFormat, n);
swaps (&stuff->xSrc, n);
swaps (&stuff->ySrc, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderTrapezoids (ClientPtr client)
{
register int n;
REQUEST(xRenderTrapezoidsReq);
REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
swaps (&stuff->length, n);
swapl (&stuff->src, n);
swapl (&stuff->dst, n);
swapl (&stuff->maskFormat, n);
swaps (&stuff->xSrc, n);
swaps (&stuff->ySrc, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,327 | SProcRenderTriangles (ClientPtr client)
{
register int n;
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
swaps (&stuff->length, n);
swapl (&stuff->src, n);
swapl (&stuff->dst, n);
swapl (&stuff->maskFormat, n);
swaps (&stuff->xSrc, n);
swaps (&stuff->ySrc, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| DoS | 0 | SProcRenderTriangles (ClientPtr client)
{
register int n;
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
swaps (&stuff->length, n);
swapl (&stuff->src, n);
swapl (&stuff->dst, n);
swapl (&stuff->maskFormat, n);
swaps (&stuff->xSrc, n);
swaps (&stuff->ySrc, n);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,328 | findVisual (ScreenPtr pScreen, VisualID vid)
{
VisualPtr pVisual;
int v;
for (v = 0; v < pScreen->numVisuals; v++)
{
pVisual = pScreen->visuals + v;
if (pVisual->vid == vid)
return pVisual;
}
return 0;
}
| DoS | 0 | findVisual (ScreenPtr pScreen, VisualID vid)
{
VisualPtr pVisual;
int v;
for (v = 0; v < pScreen->numVisuals; v++)
{
pVisual = pScreen->visuals + v;
if (pVisual->vid == vid)
return pVisual;
}
return 0;
}
| @@ -1077,6 +1077,14 @@ ProcRenderAddGlyphs (ClientPtr client)
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
+ /* protect against bad nglyphs */
+ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) ||
+ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) {
+ err = BadLength;
+ goto bail;
+ }
+
for (i = 0; i < nglyphs; i++)
{
size_t padded_width; | CWE-20 | null | null |
11,329 | static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
{
int i;
int num = cl->numCurrentContexts;
__GLXcontext **table = cl->currentContexts;
if (!glxc) return -1;
/*
** Try to find an empty slot and use it.
*/
for (i=0; i < num; i++) {
if (!table[i]) {
table[i] = glxc;
return i+1;
}
}
/*
** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
} else {
table = (__GLXcontext **) realloc(table,
(num+1)*sizeof(__GLXcontext *));
}
table[num] = glxc;
cl->currentContexts = table;
cl->numCurrentContexts++;
return num+1;
}
| DoS Exec Code | 0 | static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
{
int i;
int num = cl->numCurrentContexts;
__GLXcontext **table = cl->currentContexts;
if (!glxc) return -1;
/*
** Try to find an empty slot and use it.
*/
for (i=0; i < num; i++) {
if (!table[i]) {
table[i] = glxc;
return i+1;
}
}
/*
** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
} else {
table = (__GLXcontext **) realloc(table,
(num+1)*sizeof(__GLXcontext *));
}
table[num] = glxc;
cl->currentContexts = table;
cl->numCurrentContexts++;
return num+1;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,330 | static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
GLXContextTag tag)
{
__GLXcontext **table = cl->currentContexts;
table[tag-1] = glxc;
}
| DoS Exec Code | 0 | static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
GLXContextTag tag)
{
__GLXcontext **table = cl->currentContexts;
table[tag-1] = glxc;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,331 | DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
GLXContextID shareList, __GLXconfig *config,
__GLXscreen *pGlxScreen, GLboolean isDirect)
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
int err;
LEGAL_NEW_RESOURCE(gcId, client);
/*
** Find the display list space that we want to share.
**
** NOTE: In a multithreaded X server, we would need to keep a reference
** count for each display list so that if one client detroyed a list that
** another client was using, the list would not really be freed until it
** was no longer in use. Since this sample implementation has no support
** for multithreaded servers, we don't do this.
*/
if (shareList == None) {
shareglxc = 0;
} else {
if (!validGlxContext(client, shareList, DixReadAccess,
&shareglxc, &err))
return err;
if (shareglxc->isDirect) {
/*
** NOTE: no support for sharing display lists between direct
** contexts, even if they are in the same address space.
*/
#if 0
/* Disabling this code seems to allow shared display lists
* and texture objects to work. We'll leave it disabled for now.
*/
client->errorValue = shareList;
return BadMatch;
#endif
} else {
/*
** Create an indirect context regardless of what the client asked
** for; this way we can share display list space with shareList.
*/
isDirect = GL_FALSE;
}
}
/*
** Allocate memory for the new context
*/
if (!isDirect)
glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
else
glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
return BadAlloc;
}
/*
** Initially, setup the part of the context that could be used by
** a GL core that needs windowing information (e.g., Mesa).
*/
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
/*
** Register this context as a resource.
*/
if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
(*glxc->destroy)(glxc);
client->errorValue = gcId;
return BadAlloc;
}
/*
** Finally, now that everything is working, setup the rest of the
** context.
*/
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
glxc->isCurrent = GL_FALSE;
glxc->isDirect = isDirect;
glxc->renderMode = GL_RENDER;
__glXAddToContextList(glxc);
return Success;
}
| DoS Exec Code | 0 | DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
GLXContextID shareList, __GLXconfig *config,
__GLXscreen *pGlxScreen, GLboolean isDirect)
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
int err;
LEGAL_NEW_RESOURCE(gcId, client);
/*
** Find the display list space that we want to share.
**
** NOTE: In a multithreaded X server, we would need to keep a reference
** count for each display list so that if one client detroyed a list that
** another client was using, the list would not really be freed until it
** was no longer in use. Since this sample implementation has no support
** for multithreaded servers, we don't do this.
*/
if (shareList == None) {
shareglxc = 0;
} else {
if (!validGlxContext(client, shareList, DixReadAccess,
&shareglxc, &err))
return err;
if (shareglxc->isDirect) {
/*
** NOTE: no support for sharing display lists between direct
** contexts, even if they are in the same address space.
*/
#if 0
/* Disabling this code seems to allow shared display lists
* and texture objects to work. We'll leave it disabled for now.
*/
client->errorValue = shareList;
return BadMatch;
#endif
} else {
/*
** Create an indirect context regardless of what the client asked
** for; this way we can share display list space with shareList.
*/
isDirect = GL_FALSE;
}
}
/*
** Allocate memory for the new context
*/
if (!isDirect)
glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
else
glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
return BadAlloc;
}
/*
** Initially, setup the part of the context that could be used by
** a GL core that needs windowing information (e.g., Mesa).
*/
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
/*
** Register this context as a resource.
*/
if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
(*glxc->destroy)(glxc);
client->errorValue = gcId;
return BadAlloc;
}
/*
** Finally, now that everything is working, setup the rest of the
** context.
*/
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
glxc->isCurrent = GL_FALSE;
glxc->isDirect = isDirect;
glxc->renderMode = GL_RENDER;
__glXAddToContextList(glxc);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,332 | DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
int width, int height, XID glxDrawableId)
{
__GLXconfig *config;
__GLXscreen *pGlxScreen;
PixmapPtr pPixmap;
int err;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
return err;
__glXenterServer(GL_FALSE);
pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
width, height, config->rgbBits, 0);
__glXleaveServer(GL_FALSE);
/* Assign the pixmap the same id as the pbuffer and add it as a
* resource so it and the DRI2 drawable will be reclaimed when the
* pbuffer is destroyed. */
pPixmap->drawable.id = glxDrawableId;
if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
return BadAlloc;
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
glxDrawableId, glxDrawableId,
GLX_DRAWABLE_PBUFFER);
}
| DoS Exec Code | 0 | DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
int width, int height, XID glxDrawableId)
{
__GLXconfig *config;
__GLXscreen *pGlxScreen;
PixmapPtr pPixmap;
int err;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
return err;
__glXenterServer(GL_FALSE);
pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
width, height, config->rgbBits, 0);
__glXleaveServer(GL_FALSE);
/* Assign the pixmap the same id as the pbuffer and add it as a
* resource so it and the DRI2 drawable will be reclaimed when the
* pbuffer is destroyed. */
pPixmap->drawable.id = glxDrawableId;
if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
return BadAlloc;
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
glxDrawableId, glxDrawableId,
GLX_DRAWABLE_PBUFFER);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,333 | DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesReply reply;
__GLXdrawable *pGlxDraw;
CARD32 attributes[6];
int numAttribs, error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
DixGetAttrAccess, &pGlxDraw, &error))
return error;
numAttribs = 3;
reply.length = numAttribs << 1;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.numAttribs = numAttribs;
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT;
attributes[3] = GL_FALSE;
attributes[4] = GLX_EVENT_MASK;
attributes[5] = pGlxDraw->eventMask;
if (client->swapped) {
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
} else {
WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
(char *)&reply);
WriteToClient(client, reply.length * sizeof (CARD32),
(char *)attributes);
}
return Success;
}
| DoS Exec Code | 0 | DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
{
ClientPtr client = cl->client;
xGLXGetDrawableAttributesReply reply;
__GLXdrawable *pGlxDraw;
CARD32 attributes[6];
int numAttribs, error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
DixGetAttrAccess, &pGlxDraw, &error))
return error;
numAttribs = 3;
reply.length = numAttribs << 1;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.numAttribs = numAttribs;
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT;
attributes[3] = GL_FALSE;
attributes[4] = GLX_EVENT_MASK;
attributes[5] = pGlxDraw->eventMask;
if (client->swapped) {
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
} else {
WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
(char *)&reply);
WriteToClient(client, reply.length * sizeof (CARD32),
(char *)attributes);
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,334 | DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReply reply;
__GLXscreen *pGlxScreen;
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
int p, err;
__GLXconfig *modes;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
return err;
reply.numFBConfigs = pGlxScreen->numFBConfigs;
reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs);
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numFBConfigs);
__GLX_SWAP_INT(&reply.numAttribs);
}
WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
p = 0;
#define WRITE_PAIR(tag,value) \
do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
WRITE_PAIR( GLX_VISUAL_ID, modes->visualID );
WRITE_PAIR( GLX_FBCONFIG_ID, modes->fbconfigID );
WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE );
WRITE_PAIR( GLX_RGBA,
(modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
WRITE_PAIR( GLX_RENDER_TYPE, modes->renderType );
WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode );
WRITE_PAIR( GLX_STEREO, modes->stereoMode );
WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits );
WRITE_PAIR( GLX_LEVEL, modes->level );
WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers );
WRITE_PAIR( GLX_RED_SIZE, modes->redBits );
WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits );
WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits );
WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits );
WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits );
WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits );
WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits );
WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits );
WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType );
WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
/* GLX_VISUAL_SELECT_GROUP_SGIX ? */
WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
}
WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
(char *)buf);
}
return Success;
}
| DoS Exec Code | 0 | DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReply reply;
__GLXscreen *pGlxScreen;
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
int p, err;
__GLXconfig *modes;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
return err;
reply.numFBConfigs = pGlxScreen->numFBConfigs;
reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs);
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numFBConfigs);
__GLX_SWAP_INT(&reply.numAttribs);
}
WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
p = 0;
#define WRITE_PAIR(tag,value) \
do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
WRITE_PAIR( GLX_VISUAL_ID, modes->visualID );
WRITE_PAIR( GLX_FBCONFIG_ID, modes->fbconfigID );
WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE );
WRITE_PAIR( GLX_RGBA,
(modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
WRITE_PAIR( GLX_RENDER_TYPE, modes->renderType );
WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode );
WRITE_PAIR( GLX_STEREO, modes->stereoMode );
WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits );
WRITE_PAIR( GLX_LEVEL, modes->level );
WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers );
WRITE_PAIR( GLX_RED_SIZE, modes->redBits );
WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits );
WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits );
WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits );
WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits );
WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits );
WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits );
WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits );
WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType );
WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
/* GLX_VISUAL_SELECT_GROUP_SGIX ? */
WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
}
WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
(char *)buf);
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,335 | DoMakeCurrent(__GLXclientState *cl,
GLXDrawable drawId, GLXDrawable readId,
GLXContextID contextId, GLXContextTag tag)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReply reply;
__GLXcontext *glxc, *prevglxc;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
int error;
GLuint mask;
/*
** If one is None and the other isn't, it's a bad match.
*/
mask = (drawId == None) ? (1 << 0) : 0;
mask |= (readId == None) ? (1 << 1) : 0;
mask |= (contextId == None) ? (1 << 2) : 0;
if ( (mask != 0x00) && (mask != 0x07) ) {
return BadMatch;
}
/*
** Lookup old context. If we have one, it must be in a usable state.
*/
if (tag != 0) {
prevglxc = __glXLookupContextByTag(cl, tag);
if (!prevglxc) {
/*
** Tag for previous context is invalid.
*/
return __glXError(GLXBadContextTag);
}
if (prevglxc->renderMode != GL_RENDER) {
/* Oops. Not in render mode render. */
client->errorValue = prevglxc->id;
return __glXError(GLXBadContextState);
}
} else {
prevglxc = 0;
}
/*
** Lookup new context. It must not be current for someone else.
*/
if (contextId != None) {
int status;
if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
return error;
if ((glxc != prevglxc) && glxc->isCurrent) {
/* Context is current to somebody else */
return BadAccess;
}
assert( drawId != None );
assert( readId != None );
drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
if (drawPriv == NULL)
return status;
readPriv = __glXGetDrawable(glxc, readId, client, &status);
if (readPriv == NULL)
return status;
} else {
/* Switching to no context. Ignore new drawable. */
glxc = 0;
drawPriv = 0;
readPriv = 0;
}
if (prevglxc) {
/*
** Flush the previous context if needed.
*/
if (__GLX_HAS_UNFLUSHED_CMDS(prevglxc)) {
if (__glXForceCurrent(cl, tag, (int *)&error)) {
CALL_Flush( GET_DISPATCH(), () );
__GLX_NOTE_FLUSHED_CMDS(prevglxc);
} else {
return error;
}
}
/*
** Make the previous context not current.
*/
if (!(*prevglxc->loseCurrent)(prevglxc)) {
return __glXError(GLXBadContext);
}
__glXFlushContextCache();
if (!prevglxc->isDirect) {
prevglxc->drawPriv = NULL;
prevglxc->readPriv = NULL;
}
}
if ((glxc != 0) && !glxc->isDirect) {
glxc->drawPriv = drawPriv;
glxc->readPriv = readPriv;
/* make the context current */
if (!(*glxc->makeCurrent)(glxc)) {
glxc->drawPriv = NULL;
glxc->readPriv = NULL;
return __glXError(GLXBadContext);
}
glxc->isCurrent = GL_TRUE;
}
if (prevglxc) {
ChangeCurrentContext(cl, glxc, tag);
StopUsingContext(prevglxc);
} else {
tag = AddCurrentContext(cl, glxc);
}
if (glxc) {
StartUsingContext(cl, glxc);
reply.contextTag = tag;
} else {
reply.contextTag = 0;
}
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapMakeCurrentReply(client, &reply);
} else {
WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
}
return Success;
}
| DoS Exec Code | 0 | DoMakeCurrent(__GLXclientState *cl,
GLXDrawable drawId, GLXDrawable readId,
GLXContextID contextId, GLXContextTag tag)
{
ClientPtr client = cl->client;
xGLXMakeCurrentReply reply;
__GLXcontext *glxc, *prevglxc;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
int error;
GLuint mask;
/*
** If one is None and the other isn't, it's a bad match.
*/
mask = (drawId == None) ? (1 << 0) : 0;
mask |= (readId == None) ? (1 << 1) : 0;
mask |= (contextId == None) ? (1 << 2) : 0;
if ( (mask != 0x00) && (mask != 0x07) ) {
return BadMatch;
}
/*
** Lookup old context. If we have one, it must be in a usable state.
*/
if (tag != 0) {
prevglxc = __glXLookupContextByTag(cl, tag);
if (!prevglxc) {
/*
** Tag for previous context is invalid.
*/
return __glXError(GLXBadContextTag);
}
if (prevglxc->renderMode != GL_RENDER) {
/* Oops. Not in render mode render. */
client->errorValue = prevglxc->id;
return __glXError(GLXBadContextState);
}
} else {
prevglxc = 0;
}
/*
** Lookup new context. It must not be current for someone else.
*/
if (contextId != None) {
int status;
if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
return error;
if ((glxc != prevglxc) && glxc->isCurrent) {
/* Context is current to somebody else */
return BadAccess;
}
assert( drawId != None );
assert( readId != None );
drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
if (drawPriv == NULL)
return status;
readPriv = __glXGetDrawable(glxc, readId, client, &status);
if (readPriv == NULL)
return status;
} else {
/* Switching to no context. Ignore new drawable. */
glxc = 0;
drawPriv = 0;
readPriv = 0;
}
if (prevglxc) {
/*
** Flush the previous context if needed.
*/
if (__GLX_HAS_UNFLUSHED_CMDS(prevglxc)) {
if (__glXForceCurrent(cl, tag, (int *)&error)) {
CALL_Flush( GET_DISPATCH(), () );
__GLX_NOTE_FLUSHED_CMDS(prevglxc);
} else {
return error;
}
}
/*
** Make the previous context not current.
*/
if (!(*prevglxc->loseCurrent)(prevglxc)) {
return __glXError(GLXBadContext);
}
__glXFlushContextCache();
if (!prevglxc->isDirect) {
prevglxc->drawPriv = NULL;
prevglxc->readPriv = NULL;
}
}
if ((glxc != 0) && !glxc->isDirect) {
glxc->drawPriv = drawPriv;
glxc->readPriv = readPriv;
/* make the context current */
if (!(*glxc->makeCurrent)(glxc)) {
glxc->drawPriv = NULL;
glxc->readPriv = NULL;
return __glXError(GLXBadContext);
}
glxc->isCurrent = GL_TRUE;
}
if (prevglxc) {
ChangeCurrentContext(cl, glxc, tag);
StopUsingContext(prevglxc);
} else {
tag = AddCurrentContext(cl, glxc);
}
if (glxc) {
StartUsingContext(cl, glxc);
reply.contextTag = tag;
} else {
reply.contextTag = 0;
}
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapMakeCurrentReply(client, &reply);
} else {
WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,336 | DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
xGLXQueryContextInfoEXTReply reply;
int nProps;
int *sendBuf, *pSendBuf;
int nReplyBytes;
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
return err;
nProps = 3;
reply.length = nProps << 1;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.n = nProps;
nReplyBytes = reply.length << 2;
sendBuf = (int *)malloc((size_t)nReplyBytes);
if (sendBuf == NULL) {
return __glXError(GLXBadContext); /* XXX: Is this correct? */
}
pSendBuf = sendBuf;
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
*pSendBuf++ = (int)(ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
*pSendBuf++ = (int)(ctx->config->visualID);
*pSendBuf++ = GLX_SCREEN_EXT;
*pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
if (client->swapped) {
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
} else {
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
free((char *)sendBuf);
return Success;
}
| DoS Exec Code | 0 | DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
xGLXQueryContextInfoEXTReply reply;
int nProps;
int *sendBuf, *pSendBuf;
int nReplyBytes;
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
return err;
nProps = 3;
reply.length = nProps << 1;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.n = nProps;
nReplyBytes = reply.length << 2;
sendBuf = (int *)malloc((size_t)nReplyBytes);
if (sendBuf == NULL) {
return __glXError(GLXBadContext); /* XXX: Is this correct? */
}
pSendBuf = sendBuf;
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
*pSendBuf++ = (int)(ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
*pSendBuf++ = (int)(ctx->config->visualID);
*pSendBuf++ = GLX_SCREEN_EXT;
*pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
if (client->swapped) {
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
} else {
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
free((char *)sendBuf);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,337 | static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
{
glxc->isCurrent = GL_TRUE;
__glXLastContext = glxc;
}
| DoS Exec Code | 0 | static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
{
glxc->isCurrent = GL_TRUE;
__glXLastContext = glxc;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,338 | static void StopUsingContext(__GLXcontext *glxc)
{
if (glxc) {
if (glxc == __glXLastContext) {
/* Tell server GL library */
__glXLastContext = 0;
}
glxc->isCurrent = GL_FALSE;
if (!glxc->idExists) {
__glXFreeContext(glxc);
}
}
}
| DoS Exec Code | 0 | static void StopUsingContext(__GLXcontext *glxc)
{
if (glxc) {
if (glxc == __glXLastContext) {
/* Tell server GL library */
__glXLastContext = 0;
}
glxc->isCurrent = GL_FALSE;
if (!glxc->idExists) {
__glXFreeContext(glxc);
}
}
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,339 | __glXContextDestroy(__GLXcontext *context)
{
__glXFlushContextCache();
}
| DoS Exec Code | 0 | __glXContextDestroy(__GLXcontext *context)
{
__glXFlushContextCache();
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,340 | int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
__GLXcontext *context;
__GLXdrawable *pGlxDraw;
GLXDrawable drawId;
int buffer;
int error;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
buffer = *((INT32 *) (pc + 4));
if (buffer != GLX_FRONT_LEFT_EXT)
return __glXError(GLXBadPixmap);
context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
DixReadAccess, &pGlxDraw, &error))
return error;
if (!context->textureFromPixmap)
return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->bindTexImage(context,
buffer,
pGlxDraw);
}
| DoS Exec Code | 0 | int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
__GLXcontext *context;
__GLXdrawable *pGlxDraw;
GLXDrawable drawId;
int buffer;
int error;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
buffer = *((INT32 *) (pc + 4));
if (buffer != GLX_FRONT_LEFT_EXT)
return __glXError(GLXBadPixmap);
context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
DixReadAccess, &pGlxDraw, &error))
return error;
if (!context->textureFromPixmap)
return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->bindTexImage(context,
buffer,
pGlxDraw);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,341 | int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
xGLXChangeDrawableAttributesReq *req =
(xGLXChangeDrawableAttributesReq *) pc;
return DoChangeDrawableAttributes(cl->client, req->drawable,
req->numAttribs, (CARD32 *) (req + 1));
}
| DoS Exec Code | 0 | int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
xGLXChangeDrawableAttributesReq *req =
(xGLXChangeDrawableAttributesReq *) pc;
return DoChangeDrawableAttributes(cl->client, req->drawable,
req->numAttribs, (CARD32 *) (req + 1));
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,342 | int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXChangeDrawableAttributesSGIXReq *req =
(xGLXChangeDrawableAttributesSGIXReq *)pc;
return DoChangeDrawableAttributes(cl->client, req->drawable,
req->numAttribs, (CARD32 *) (req + 1));
}
| DoS Exec Code | 0 | int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXChangeDrawableAttributesSGIXReq *req =
(xGLXChangeDrawableAttributesSGIXReq *)pc;
return DoChangeDrawableAttributes(cl->client, req->drawable,
req->numAttribs, (CARD32 *) (req + 1));
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,343 | int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
{
xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
const char *buf;
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
buf = (const char *)(req+1);
cl->GLClientextensions = strdup(buf);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
{
xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
const char *buf;
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
buf = (const char *)(req+1);
cl->GLClientextensions = strdup(buf);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,344 | int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
GLXContextID source = req->source;
GLXContextID dest = req->dest;
GLXContextTag tag = req->contextTag;
unsigned long mask = req->mask;
__GLXcontext *src, *dst;
int error;
if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
return error;
if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
return error;
/*
** They must be in the same address space, and same screen.
** NOTE: no support for direct rendering contexts here.
*/
if (src->isDirect || dst->isDirect ||
(src->pGlxScreen != dst->pGlxScreen)) {
client->errorValue = source;
return BadMatch;
}
/*
** The destination context must not be current for any client.
*/
if (dst->isCurrent) {
client->errorValue = dest;
return BadAccess;
}
if (tag) {
__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
if (!tagcx) {
return __glXError(GLXBadContextTag);
}
if (tagcx != src) {
/*
** This would be caused by a faulty implementation of the client
** library.
*/
return BadMatch;
}
/*
** In this case, glXCopyContext is in both GL and X streams, in terms
** of sequentiality.
*/
if (__glXForceCurrent(cl, tag, &error)) {
/*
** Do whatever is needed to make sure that all preceding requests
** in both streams are completed before the copy is executed.
*/
CALL_Finish( GET_DISPATCH(), () );
__GLX_NOTE_FLUSHED_CMDS(tagcx);
} else {
return error;
}
}
/*
** Issue copy. The only reason for failure is a bad mask.
*/
if (!(*dst->copy)(dst, src, mask)) {
client->errorValue = mask;
return BadValue;
}
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
GLXContextID source = req->source;
GLXContextID dest = req->dest;
GLXContextTag tag = req->contextTag;
unsigned long mask = req->mask;
__GLXcontext *src, *dst;
int error;
if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
return error;
if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
return error;
/*
** They must be in the same address space, and same screen.
** NOTE: no support for direct rendering contexts here.
*/
if (src->isDirect || dst->isDirect ||
(src->pGlxScreen != dst->pGlxScreen)) {
client->errorValue = source;
return BadMatch;
}
/*
** The destination context must not be current for any client.
*/
if (dst->isCurrent) {
client->errorValue = dest;
return BadAccess;
}
if (tag) {
__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
if (!tagcx) {
return __glXError(GLXBadContextTag);
}
if (tagcx != src) {
/*
** This would be caused by a faulty implementation of the client
** library.
*/
return BadMatch;
}
/*
** In this case, glXCopyContext is in both GL and X streams, in terms
** of sequentiality.
*/
if (__glXForceCurrent(cl, tag, &error)) {
/*
** Do whatever is needed to make sure that all preceding requests
** in both streams are completed before the copy is executed.
*/
CALL_Finish( GET_DISPATCH(), () );
__GLX_NOTE_FLUSHED_CMDS(tagcx);
} else {
return error;
}
}
/*
** Issue copy. The only reason for failure is a bad mask.
*/
if (!(*dst->copy)(dst, src, mask)) {
client->errorValue = mask;
return BadValue;
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,345 | int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
}
| DoS Exec Code | 0 | int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,346 | int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateContextWithConfigSGIXReq *req =
(xGLXCreateContextWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
}
| DoS Exec Code | 0 | int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateContextWithConfigSGIXReq *req =
(xGLXCreateContextWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,347 | int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
req->width, req->height, req->pbuffer);
}
| DoS Exec Code | 0 | int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
req->width, req->height, req->pbuffer);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,348 | int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen, config,
req->pixmap, req->glxpixmap);
}
| DoS Exec Code | 0 | int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen, config,
req->pixmap, req->glxpixmap);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,349 | int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapWithConfigSGIXReq *req =
(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen,
config, req->pixmap, req->glxpixmap);
}
| DoS Exec Code | 0 | int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapWithConfigSGIXReq *req =
(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
return DoCreateGLXPixmap(cl->client, pGlxScreen,
config, req->pixmap, req->glxpixmap);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,350 | int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
}
| DoS Exec Code | 0 | int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,351 | int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
CARD32 *attrs;
int width, height, i;
attrs = (CARD32 *) (req + 1);
width = 0;
height = 0;
for (i = 0; i < req->numAttribs; i++) {
switch (attrs[i * 2]) {
case GLX_PBUFFER_WIDTH:
width = attrs[i * 2 + 1];
break;
case GLX_PBUFFER_HEIGHT:
height = attrs[i * 2 + 1];
break;
case GLX_LARGEST_PBUFFER:
case GLX_PRESERVED_CONTENTS:
/* FIXME: huh... */
break;
}
}
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
width, height, req->pbuffer);
}
| DoS Exec Code | 0 | int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
CARD32 *attrs;
int width, height, i;
attrs = (CARD32 *) (req + 1);
width = 0;
height = 0;
for (i = 0; i < req->numAttribs; i++) {
switch (attrs[i * 2]) {
case GLX_PBUFFER_WIDTH:
width = attrs[i * 2 + 1];
break;
case GLX_PBUFFER_HEIGHT:
height = attrs[i * 2 + 1];
break;
case GLX_LARGEST_PBUFFER:
case GLX_PRESERVED_CONTENTS:
/* FIXME: huh... */
break;
}
}
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
width, height, req->pbuffer);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,352 | int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
err = DoCreateGLXPixmap(cl->client, pGlxScreen, config,
req->pixmap, req->glxpixmap);
if (err != Success)
return err;
determineTextureTarget(cl->client, req->glxpixmap,
(CARD32*) (req + 1), req->numAttribs);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
return err;
err = DoCreateGLXPixmap(cl->client, pGlxScreen, config,
req->pixmap, req->glxpixmap);
if (err != Success)
return err;
determineTextureTarget(cl->client, req->glxpixmap,
(CARD32*) (req + 1), req->numAttribs);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,353 | int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
__GLXcontext *glxc;
int err;
if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
&glxc, &err))
return err;
FreeResourceByType(req->context, __glXContextRes, FALSE);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
__GLXcontext *glxc;
int err;
if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
&glxc, &err))
return err;
FreeResourceByType(req->context, __glXContextRes, FALSE);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,354 | int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
}
| DoS Exec Code | 0 | int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,355 | int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
| DoS Exec Code | 0 | int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,356 | int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
}
| DoS Exec Code | 0 | int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,357 | int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
| DoS Exec Code | 0 | int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,358 | int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
}
| DoS Exec Code | 0 | int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
{
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,359 | int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
return DoGetDrawableAttributes(cl, req->drawable);
}
| DoS Exec Code | 0 | int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
return DoGetDrawableAttributes(cl, req->drawable);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,360 | int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetDrawableAttributesSGIXReq *req =
(xGLXGetDrawableAttributesSGIXReq *)pc;
return DoGetDrawableAttributes(cl, req->drawable);
}
| DoS Exec Code | 0 | int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetDrawableAttributesSGIXReq *req =
(xGLXGetDrawableAttributesSGIXReq *)pc;
return DoGetDrawableAttributes(cl, req->drawable);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,361 | int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
return DoGetFBConfigs(cl, req->screen);
}
| DoS Exec Code | 0 | int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
return DoGetFBConfigs(cl, req->screen);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,362 | int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
return DoGetFBConfigs(cl, req->screen);
}
| DoS Exec Code | 0 | int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
return DoGetFBConfigs(cl, req->screen);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,363 | int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
ClientPtr client = cl->client;
xGLXGetVisualConfigsReply reply;
__GLXscreen *pGlxScreen;
__GLXconfig *modes;
CARD32 buf[GLX_VIS_CONFIG_TOTAL];
int p, i, err;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
reply.numVisuals = pGlxScreen->numVisuals;
reply.numProps = GLX_VIS_CONFIG_TOTAL;
reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numVisuals);
__GLX_SWAP_INT(&reply.numProps);
}
WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
for (i = 0; i < pGlxScreen->numVisuals; i++) {
modes = pGlxScreen->visuals[i];
p = 0;
buf[p++] = modes->visualID;
buf[p++] = glxConvertToXVisualType( modes->visualType );
buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
buf[p++] = modes->redBits;
buf[p++] = modes->greenBits;
buf[p++] = modes->blueBits;
buf[p++] = modes->alphaBits;
buf[p++] = modes->accumRedBits;
buf[p++] = modes->accumGreenBits;
buf[p++] = modes->accumBlueBits;
buf[p++] = modes->accumAlphaBits;
buf[p++] = modes->doubleBufferMode;
buf[p++] = modes->stereoMode;
buf[p++] = modes->rgbBits;
buf[p++] = modes->depthBits;
buf[p++] = modes->stencilBits;
buf[p++] = modes->numAuxBuffers;
buf[p++] = modes->level;
assert(p == GLX_VIS_CONFIG_UNPAIRED);
/*
** Add token/value pairs for extensions.
*/
buf[p++] = GLX_VISUAL_CAVEAT_EXT;
buf[p++] = modes->visualRating;
buf[p++] = GLX_TRANSPARENT_TYPE;
buf[p++] = modes->transparentPixel;
buf[p++] = GLX_TRANSPARENT_RED_VALUE;
buf[p++] = modes->transparentRed;
buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
buf[p++] = modes->transparentGreen;
buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
buf[p++] = modes->transparentBlue;
buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
buf[p++] = modes->transparentAlpha;
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
buf[p++] = modes->transparentIndex;
buf[p++] = GLX_SAMPLES_SGIS;
buf[p++] = modes->samples;
buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
buf[p++] = modes->sampleBuffers;
buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
buf[p++] = 0;
assert(p == GLX_VIS_CONFIG_TOTAL);
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, p);
}
WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf);
}
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
{
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
ClientPtr client = cl->client;
xGLXGetVisualConfigsReply reply;
__GLXscreen *pGlxScreen;
__GLXconfig *modes;
CARD32 buf[GLX_VIS_CONFIG_TOTAL];
int p, i, err;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
reply.numVisuals = pGlxScreen->numVisuals;
reply.numProps = GLX_VIS_CONFIG_TOTAL;
reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numVisuals);
__GLX_SWAP_INT(&reply.numProps);
}
WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
for (i = 0; i < pGlxScreen->numVisuals; i++) {
modes = pGlxScreen->visuals[i];
p = 0;
buf[p++] = modes->visualID;
buf[p++] = glxConvertToXVisualType( modes->visualType );
buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
buf[p++] = modes->redBits;
buf[p++] = modes->greenBits;
buf[p++] = modes->blueBits;
buf[p++] = modes->alphaBits;
buf[p++] = modes->accumRedBits;
buf[p++] = modes->accumGreenBits;
buf[p++] = modes->accumBlueBits;
buf[p++] = modes->accumAlphaBits;
buf[p++] = modes->doubleBufferMode;
buf[p++] = modes->stereoMode;
buf[p++] = modes->rgbBits;
buf[p++] = modes->depthBits;
buf[p++] = modes->stencilBits;
buf[p++] = modes->numAuxBuffers;
buf[p++] = modes->level;
assert(p == GLX_VIS_CONFIG_UNPAIRED);
/*
** Add token/value pairs for extensions.
*/
buf[p++] = GLX_VISUAL_CAVEAT_EXT;
buf[p++] = modes->visualRating;
buf[p++] = GLX_TRANSPARENT_TYPE;
buf[p++] = modes->transparentPixel;
buf[p++] = GLX_TRANSPARENT_RED_VALUE;
buf[p++] = modes->transparentRed;
buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
buf[p++] = modes->transparentGreen;
buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
buf[p++] = modes->transparentBlue;
buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
buf[p++] = modes->transparentAlpha;
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
buf[p++] = modes->transparentIndex;
buf[p++] = GLX_SAMPLES_SGIS;
buf[p++] = modes->samples;
buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
buf[p++] = modes->sampleBuffers;
buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
buf[p++] = 0;
assert(p == GLX_VIS_CONFIG_TOTAL);
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, p);
}
WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf);
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,364 | int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
xGLXIsDirectReply reply;
__GLXcontext *glxc;
int err;
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err;
reply.isDirect = glxc->isDirect;
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapIsDirectReply(client, &reply);
} else {
WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
}
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
xGLXIsDirectReply reply;
__GLXcontext *glxc;
int err;
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err;
reply.isDirect = glxc->isDirect;
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapIsDirectReply(client, &reply);
} else {
WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,365 | int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
return DoMakeCurrent( cl, req->drawable, req->drawable,
req->context, req->oldContextTag );
}
| DoS Exec Code | 0 | int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
return DoMakeCurrent( cl, req->drawable, req->drawable,
req->context, req->oldContextTag );
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,366 | int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
return DoMakeCurrent( cl, req->drawable, req->readable,
req->context, req->oldContextTag );
}
| DoS Exec Code | 0 | int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
return DoMakeCurrent( cl, req->drawable, req->readable,
req->context, req->oldContextTag );
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,367 | int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
return DoQueryContext(cl, req->context);
}
| DoS Exec Code | 0 | int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
return DoQueryContext(cl, req->context);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,368 | int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
return DoQueryContext(cl, req->context);
}
| DoS Exec Code | 0 | int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
return DoQueryContext(cl, req->context);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,369 | int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
xGLXQueryExtensionsStringReply reply;
__GLXscreen *pGlxScreen;
size_t n, length;
char *buf;
int err;
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = length;
reply.n = n;
/* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
buf = (char *) malloc(length << 2);
if (buf == NULL)
return BadAlloc;
memcpy(buf, pGlxScreen->GLXextensions, n);
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, buf);
} else {
WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
WriteToClient(client, (int)(length << 2), (char *)buf);
}
free(buf);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
xGLXQueryExtensionsStringReply reply;
__GLXscreen *pGlxScreen;
size_t n, length;
char *buf;
int err;
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = length;
reply.n = n;
/* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
buf = (char *) malloc(length << 2);
if (buf == NULL)
return BadAlloc;
memcpy(buf, pGlxScreen->GLXextensions, n);
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, buf);
} else {
WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
WriteToClient(client, (int)(length << 2), (char *)buf);
}
free(buf);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,370 | int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
xGLXQueryServerStringReply reply;
size_t n, length;
const char *ptr;
char *buf;
__GLXscreen *pGlxScreen;
int err;
char ver_str[16];
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
switch(req->name) {
case GLX_VENDOR:
ptr = pGlxScreen->GLXvendor;
break;
case GLX_VERSION:
/* Return to the server version rather than the screen version
* to prevent confusion when they do not match.
*/
snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
ptr = ver_str;
break;
case GLX_EXTENSIONS:
ptr = pGlxScreen->GLXextensions;
break;
default:
return BadValue;
}
n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = length;
reply.n = n;
buf = (char *) malloc(length << 2);
if (buf == NULL) {
return BadAlloc;
}
memcpy(buf, ptr, n);
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, buf);
} else {
WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
WriteToClient(client, (int)(length << 2), buf);
}
free(buf);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
xGLXQueryServerStringReply reply;
size_t n, length;
const char *ptr;
char *buf;
__GLXscreen *pGlxScreen;
int err;
char ver_str[16];
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
switch(req->name) {
case GLX_VENDOR:
ptr = pGlxScreen->GLXvendor;
break;
case GLX_VERSION:
/* Return to the server version rather than the screen version
* to prevent confusion when they do not match.
*/
snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
ptr = ver_str;
break;
case GLX_EXTENSIONS:
ptr = pGlxScreen->GLXextensions;
break;
default:
return BadValue;
}
n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = length;
reply.n = n;
buf = (char *) malloc(length << 2);
if (buf == NULL) {
return BadAlloc;
}
memcpy(buf, ptr, n);
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, buf);
} else {
WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
WriteToClient(client, (int)(length << 2), buf);
}
free(buf);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,371 | int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
xGLXQueryVersionReply reply;
GLuint major, minor;
major = req->majorVersion;
minor = req->minorVersion;
(void)major;
(void)minor;
/*
** Server should take into consideration the version numbers sent by the
** client if it wants to work with older clients; however, in this
** implementation the server just returns its version number.
*/
reply.majorVersion = glxMajorVersion;
reply.minorVersion = glxMinorVersion;
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapQueryVersionReply(client, &reply);
} else {
WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
}
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
xGLXQueryVersionReply reply;
GLuint major, minor;
major = req->majorVersion;
minor = req->minorVersion;
(void)major;
(void)minor;
/*
** Server should take into consideration the version numbers sent by the
** client if it wants to work with older clients; however, in this
** implementation the server just returns its version number.
*/
reply.majorVersion = glxMajorVersion;
reply.minorVersion = glxMinorVersion;
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapQueryVersionReply(client, &reply);
} else {
WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
}
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,372 | int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
__GLXdrawable *pGlxDraw;
__GLXcontext *context;
GLXDrawable drawId;
int buffer;
int error;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
buffer = *((INT32 *) (pc + 4));
context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
DixReadAccess, &pGlxDraw, &error))
return error;
if (!context->textureFromPixmap)
return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->releaseTexImage(context,
buffer,
pGlxDraw);
}
| DoS Exec Code | 0 | int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
ClientPtr client = cl->client;
__GLXdrawable *pGlxDraw;
__GLXcontext *context;
GLXDrawable drawId;
int buffer;
int error;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc));
buffer = *((INT32 *) (pc + 4));
context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
return error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
DixReadAccess, &pGlxDraw, &error))
return error;
if (!context->textureFromPixmap)
return __glXError(GLXUnsupportedPrivateRequest);
return context->textureFromPixmap->releaseTexImage(context,
buffer,
pGlxDraw);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,373 | int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
{
xGLXRenderLargeReq *req;
ClientPtr client= cl->client;
size_t dataBytes;
__GLXrenderLargeHeader *hdr;
__GLXcontext *glxc;
int error;
CARD16 opcode;
__GLX_DECLARE_SWAP_VARIABLES;
req = (xGLXRenderLargeReq *) pc;
if (client->swapped) {
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(&req->dataBytes);
__GLX_SWAP_SHORT(&req->requestNumber);
__GLX_SWAP_SHORT(&req->requestTotal);
}
glxc = __glXForceCurrent(cl, req->contextTag, &error);
if (!glxc) {
/* Reset in case this isn't 1st request. */
__glXResetLargeCommandStatus(cl);
return error;
}
dataBytes = req->dataBytes;
/*
** Check the request length.
*/
if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
client->errorValue = req->length;
/* Reset in case this isn't 1st request. */
__glXResetLargeCommandStatus(cl);
return BadLength;
}
pc += sz_xGLXRenderLargeReq;
if (cl->largeCmdRequestsSoFar == 0) {
__GLXrenderSizeData entry;
int extra;
size_t cmdlen;
int err;
/*
** This is the first request of a multi request command.
** Make enough space in the buffer, then copy the entire request.
*/
if (req->requestNumber != 1) {
client->errorValue = req->requestNumber;
return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) pc;
if (client->swapped) {
__GLX_SWAP_INT(&hdr->length);
__GLX_SWAP_INT(&hdr->opcode);
}
cmdlen = hdr->length;
opcode = hdr->opcode;
/*
** Check for core opcodes and grab entry data.
*/
err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
if (err < 0) {
client->errorValue = opcode;
return __glXError(GLXBadLargeRequest);
}
if (entry.varsize) {
/*
** If it's a variable-size command (a command whose length must
** be computed from its parameters), all the parameters needed
** will be in the 1st request, so it's okay to do this.
*/
extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
client->swapped);
if (extra < 0) {
extra = 0;
}
/* large command's header is 4 bytes longer, so add 4 */
if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
return BadLength;
}
} else {
/* constant size command */
if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
return BadLength;
}
}
/*
** Make enough space in the buffer, then copy the entire request.
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
} else {
cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
}
cl->largeCmdBufSize = cmdlen;
}
memcpy(cl->largeCmdBuf, pc, dataBytes);
cl->largeCmdBytesSoFar = dataBytes;
cl->largeCmdBytesTotal = cmdlen;
cl->largeCmdRequestsSoFar = 1;
cl->largeCmdRequestsTotal = req->requestTotal;
return Success;
} else {
/*
** We are receiving subsequent (i.e. not the first) requests of a
** multi request command.
*/
/*
** Check the request number and the total request count.
*/
if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
client->errorValue = req->requestNumber;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
if (req->requestTotal != cl->largeCmdRequestsTotal) {
client->errorValue = req->requestTotal;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
/*
** Check that we didn't get too much data.
*/
if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
client->errorValue = dataBytes;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
cl->largeCmdBytesSoFar += dataBytes;
cl->largeCmdRequestsSoFar++;
if (req->requestNumber == cl->largeCmdRequestsTotal) {
__GLXdispatchRenderProcPtr proc;
/*
** This is the last request; it must have enough bytes to complete
** the command.
*/
/* NOTE: the two pad macros have been added below; they are needed
** because the client library pads the total byte count, but not
** the per-request byte counts. The Protocol Encoding says the
** total byte count should not be padded, so a proposal will be
** made to the ARB to relax the padding constraint on the total
** byte count, thus preserving backward compatibility. Meanwhile,
** the padding done below fixes a bug that did not allow
** large commands of odd sizes to be accepted by the server.
*/
if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
__GLX_PAD(cl->largeCmdBytesTotal)) {
client->errorValue = dataBytes;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
/*
** The opcode and length field in the header had already been
** swapped when the first request was received.
**
** Use the opcode to index into the procedure table.
*/
opcode = hdr->opcode;
proc = (__GLXdispatchRenderProcPtr)
__glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
client->swapped);
if (proc == NULL) {
client->errorValue = opcode;
return __glXError(GLXBadLargeRequest);
}
/*
** Skip over the header and execute the command.
*/
(*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
__GLX_NOTE_UNFLUSHED_CMDS(glxc);
/*
** Reset for the next RenderLarge series.
*/
__glXResetLargeCommandStatus(cl);
} else {
/*
** This is neither the first nor the last request.
*/
}
return Success;
}
}
| DoS Exec Code | 0 | int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
{
xGLXRenderLargeReq *req;
ClientPtr client= cl->client;
size_t dataBytes;
__GLXrenderLargeHeader *hdr;
__GLXcontext *glxc;
int error;
CARD16 opcode;
__GLX_DECLARE_SWAP_VARIABLES;
req = (xGLXRenderLargeReq *) pc;
if (client->swapped) {
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(&req->dataBytes);
__GLX_SWAP_SHORT(&req->requestNumber);
__GLX_SWAP_SHORT(&req->requestTotal);
}
glxc = __glXForceCurrent(cl, req->contextTag, &error);
if (!glxc) {
/* Reset in case this isn't 1st request. */
__glXResetLargeCommandStatus(cl);
return error;
}
dataBytes = req->dataBytes;
/*
** Check the request length.
*/
if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
client->errorValue = req->length;
/* Reset in case this isn't 1st request. */
__glXResetLargeCommandStatus(cl);
return BadLength;
}
pc += sz_xGLXRenderLargeReq;
if (cl->largeCmdRequestsSoFar == 0) {
__GLXrenderSizeData entry;
int extra;
size_t cmdlen;
int err;
/*
** This is the first request of a multi request command.
** Make enough space in the buffer, then copy the entire request.
*/
if (req->requestNumber != 1) {
client->errorValue = req->requestNumber;
return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) pc;
if (client->swapped) {
__GLX_SWAP_INT(&hdr->length);
__GLX_SWAP_INT(&hdr->opcode);
}
cmdlen = hdr->length;
opcode = hdr->opcode;
/*
** Check for core opcodes and grab entry data.
*/
err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
if (err < 0) {
client->errorValue = opcode;
return __glXError(GLXBadLargeRequest);
}
if (entry.varsize) {
/*
** If it's a variable-size command (a command whose length must
** be computed from its parameters), all the parameters needed
** will be in the 1st request, so it's okay to do this.
*/
extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
client->swapped);
if (extra < 0) {
extra = 0;
}
/* large command's header is 4 bytes longer, so add 4 */
if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
return BadLength;
}
} else {
/* constant size command */
if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
return BadLength;
}
}
/*
** Make enough space in the buffer, then copy the entire request.
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
} else {
cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
}
cl->largeCmdBufSize = cmdlen;
}
memcpy(cl->largeCmdBuf, pc, dataBytes);
cl->largeCmdBytesSoFar = dataBytes;
cl->largeCmdBytesTotal = cmdlen;
cl->largeCmdRequestsSoFar = 1;
cl->largeCmdRequestsTotal = req->requestTotal;
return Success;
} else {
/*
** We are receiving subsequent (i.e. not the first) requests of a
** multi request command.
*/
/*
** Check the request number and the total request count.
*/
if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
client->errorValue = req->requestNumber;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
if (req->requestTotal != cl->largeCmdRequestsTotal) {
client->errorValue = req->requestTotal;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
/*
** Check that we didn't get too much data.
*/
if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
client->errorValue = dataBytes;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
cl->largeCmdBytesSoFar += dataBytes;
cl->largeCmdRequestsSoFar++;
if (req->requestNumber == cl->largeCmdRequestsTotal) {
__GLXdispatchRenderProcPtr proc;
/*
** This is the last request; it must have enough bytes to complete
** the command.
*/
/* NOTE: the two pad macros have been added below; they are needed
** because the client library pads the total byte count, but not
** the per-request byte counts. The Protocol Encoding says the
** total byte count should not be padded, so a proposal will be
** made to the ARB to relax the padding constraint on the total
** byte count, thus preserving backward compatibility. Meanwhile,
** the padding done below fixes a bug that did not allow
** large commands of odd sizes to be accepted by the server.
*/
if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
__GLX_PAD(cl->largeCmdBytesTotal)) {
client->errorValue = dataBytes;
__glXResetLargeCommandStatus(cl);
return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
/*
** The opcode and length field in the header had already been
** swapped when the first request was received.
**
** Use the opcode to index into the procedure table.
*/
opcode = hdr->opcode;
proc = (__GLXdispatchRenderProcPtr)
__glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
client->swapped);
if (proc == NULL) {
client->errorValue = opcode;
return __glXError(GLXBadLargeRequest);
}
/*
** Skip over the header and execute the command.
*/
(*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
__GLX_NOTE_UNFLUSHED_CMDS(glxc);
/*
** Reset for the next RenderLarge series.
*/
__glXResetLargeCommandStatus(cl);
} else {
/*
** This is neither the first nor the last request.
*/
}
return Success;
}
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,374 | int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
GLXContextTag tag = req->contextTag;
XID drawId = req->drawable;
__GLXcontext *glxc = NULL;
__GLXdrawable *pGlxDraw;
int error;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
if (!glxc) {
return __glXError(GLXBadContextTag);
}
/*
** The calling thread is swapping its current drawable. In this case,
** glxSwapBuffers is in both GL and X streams, in terms of
** sequentiality.
*/
if (__glXForceCurrent(cl, tag, &error)) {
/*
** Do whatever is needed to make sure that all preceding requests
** in both streams are completed before the swap is executed.
*/
CALL_Finish( GET_DISPATCH(), () );
__GLX_NOTE_FLUSHED_CMDS(glxc);
} else {
return error;
}
}
pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
if (pGlxDraw == NULL)
return error;
if (pGlxDraw->type == DRAWABLE_WINDOW &&
(*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE)
return __glXError(GLXBadDrawable);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
GLXContextTag tag = req->contextTag;
XID drawId = req->drawable;
__GLXcontext *glxc = NULL;
__GLXdrawable *pGlxDraw;
int error;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
if (!glxc) {
return __glXError(GLXBadContextTag);
}
/*
** The calling thread is swapping its current drawable. In this case,
** glxSwapBuffers is in both GL and X streams, in terms of
** sequentiality.
*/
if (__glXForceCurrent(cl, tag, &error)) {
/*
** Do whatever is needed to make sure that all preceding requests
** in both streams are completed before the swap is executed.
*/
CALL_Finish( GET_DISPATCH(), () );
__GLX_NOTE_FLUSHED_CMDS(glxc);
} else {
return error;
}
}
pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
if (pGlxDraw == NULL)
return error;
if (pGlxDraw->type == DRAWABLE_WINDOW &&
(*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE)
return __glXError(GLXBadDrawable);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,375 | int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLint vendorcode = req->vendorCode;
__GLXdispatchVendorPrivProcPtr proc;
proc = (__GLXdispatchVendorPrivProcPtr)
__glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
vendorcode, 0);
if (proc != NULL) {
(*proc)(cl, (GLbyte*)req);
return Success;
}
cl->client->errorValue = req->vendorCode;
return __glXError(GLXUnsupportedPrivateRequest);
}
| DoS Exec Code | 0 | int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLint vendorcode = req->vendorCode;
__GLXdispatchVendorPrivProcPtr proc;
proc = (__GLXdispatchVendorPrivProcPtr)
__glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
vendorcode, 0);
if (proc != NULL) {
(*proc)(cl, (GLbyte*)req);
return Success;
}
cl->client->errorValue = req->vendorCode;
return __glXError(GLXUnsupportedPrivateRequest);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,376 | int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLint vendorcode = req->vendorCode;
__GLXdispatchVendorPrivProcPtr proc;
proc = (__GLXdispatchVendorPrivProcPtr)
__glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
vendorcode, 0);
if (proc != NULL) {
return (*proc)(cl, (GLbyte*)req);
}
cl->client->errorValue = vendorcode;
return __glXError(GLXUnsupportedPrivateRequest);
}
| DoS Exec Code | 0 | int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLint vendorcode = req->vendorCode;
__GLXdispatchVendorPrivProcPtr proc;
proc = (__GLXdispatchVendorPrivProcPtr)
__glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
vendorcode, 0);
if (proc != NULL) {
return (*proc)(cl, (GLbyte*)req);
}
cl->client->errorValue = vendorcode;
return __glXError(GLXUnsupportedPrivateRequest);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,377 | int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
{
xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
GLXContextTag tag = req->contextTag;
__GLXcontext *glxc = NULL;
int error;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
if (!glxc)
return __glXError(GLXBadContextTag);
if (!__glXForceCurrent(cl, req->contextTag, &error))
return error;
CALL_Finish( GET_DISPATCH(), () );
}
if (glxc && glxc->drawPriv->waitGL)
(*glxc->drawPriv->waitGL)(glxc->drawPriv);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
{
xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
GLXContextTag tag = req->contextTag;
__GLXcontext *glxc = NULL;
int error;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
if (!glxc)
return __glXError(GLXBadContextTag);
if (!__glXForceCurrent(cl, req->contextTag, &error))
return error;
CALL_Finish( GET_DISPATCH(), () );
}
if (glxc && glxc->drawPriv->waitGL)
(*glxc->drawPriv->waitGL)(glxc->drawPriv);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,378 | int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
{
xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
GLXContextTag tag = req->contextTag;
__GLXcontext *glxc = NULL;
int error;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
if (!glxc)
return __glXError(GLXBadContextTag);
if (!__glXForceCurrent(cl, req->contextTag, &error))
return error;
}
if (glxc && glxc->drawPriv->waitX)
(*glxc->drawPriv->waitX)(glxc->drawPriv);
return Success;
}
| DoS Exec Code | 0 | int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
{
xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
GLXContextTag tag = req->contextTag;
__GLXcontext *glxc = NULL;
int error;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
if (!glxc)
return __glXError(GLXBadContextTag);
if (!__glXForceCurrent(cl, req->contextTag, &error))
return error;
}
if (glxc && glxc->drawPriv->waitX)
(*glxc->drawPriv->waitX)(glxc->drawPriv);
return Success;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,379 | __glXDrawableRelease(__GLXdrawable *drawable)
{
}
| DoS Exec Code | 0 | __glXDrawableRelease(__GLXdrawable *drawable)
{
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,380 | __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
int *error)
{
DrawablePtr pDraw;
__GLXdrawable *pGlxDraw;
int rc;
if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
DixWriteAccess, &pGlxDraw, &rc)) {
if (glxc != NULL && pGlxDraw->config != glxc->config) {
client->errorValue = drawId;
*error = BadMatch;
return NULL;
}
return pGlxDraw;
}
/* No active context and an unknown drawable, bail. */
if (glxc == NULL) {
client->errorValue = drawId;
*error = BadMatch;
return NULL;
}
/* The drawId wasn't a GLX drawable. Make sure it's a window and
* create a GLXWindow for it. Check that the drawable screen
* matches the context screen and that the context fbconfig is
* compatible with the window visual. */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = drawId;
*error = __glXError(GLXBadDrawable);
return NULL;
}
if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
client->errorValue = pDraw->pScreen->myNum;
*error = BadMatch;
return NULL;
}
if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
return NULL;
pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
pDraw, drawId,
GLX_DRAWABLE_WINDOW,
drawId, glxc->config);
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
pGlxDraw->destroy (pGlxDraw);
*error = BadAlloc;
return NULL;
}
return pGlxDraw;
}
| DoS Exec Code | 0 | __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
int *error)
{
DrawablePtr pDraw;
__GLXdrawable *pGlxDraw;
int rc;
if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
DixWriteAccess, &pGlxDraw, &rc)) {
if (glxc != NULL && pGlxDraw->config != glxc->config) {
client->errorValue = drawId;
*error = BadMatch;
return NULL;
}
return pGlxDraw;
}
/* No active context and an unknown drawable, bail. */
if (glxc == NULL) {
client->errorValue = drawId;
*error = BadMatch;
return NULL;
}
/* The drawId wasn't a GLX drawable. Make sure it's a window and
* create a GLXWindow for it. Check that the drawable screen
* matches the context screen and that the context fbconfig is
* compatible with the window visual. */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = drawId;
*error = __glXError(GLXBadDrawable);
return NULL;
}
if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
client->errorValue = pDraw->pScreen->myNum;
*error = BadMatch;
return NULL;
}
if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
return NULL;
pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
pDraw, drawId,
GLX_DRAWABLE_WINDOW,
drawId, glxc->config);
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
pGlxDraw->destroy (pGlxDraw);
*error = BadAlloc;
return NULL;
}
return pGlxDraw;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,381 | __GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
if (tag < 1 || tag > num) {
return 0;
} else {
return cl->currentContexts[tag-1];
}
}
| DoS Exec Code | 0 | __GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
if (tag < 1 || tag > num) {
return 0;
} else {
return cl->currentContexts[tag-1];
}
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,382 | static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
__GLXconfig *modes,
__GLXcontext *shareContext)
{
__GLXcontext *context;
context = calloc(1, sizeof (__GLXcontext));
if (context == NULL)
return NULL;
context->destroy = __glXdirectContextDestroy;
return context;
}
| DoS Exec Code | 0 | static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
__GLXconfig *modes,
__GLXcontext *shareContext)
{
__GLXcontext *context;
context = calloc(1, sizeof (__GLXcontext));
if (context == NULL)
return NULL;
context->destroy = __glXdirectContextDestroy;
return context;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,383 | static void __glXdirectContextDestroy(__GLXcontext *context)
{
__glXContextDestroy(context);
free(context);
}
| DoS Exec Code | 0 | static void __glXdirectContextDestroy(__GLXcontext *context)
{
__glXContextDestroy(context);
free(context);
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,384 | determineTextureTarget(ClientPtr client, XID glxDrawableID,
CARD32 *attribs, CARD32 numAttribs)
{
GLenum target = 0;
GLenum format = 0;
int i, err;
__GLXdrawable *pGlxDraw;
if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
DixWriteAccess, &pGlxDraw, &err))
/* We just added it in CreatePixmap, so we should never get here. */
return;
for (i = 0; i < numAttribs; i++) {
if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
switch (attribs[2 * i + 1]) {
case GLX_TEXTURE_2D_EXT:
target = GL_TEXTURE_2D;
break;
case GLX_TEXTURE_RECTANGLE_EXT:
target = GL_TEXTURE_RECTANGLE_ARB;
break;
}
}
if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
format = attribs[2 * i + 1];
}
if (!target) {
int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
if (h & (h - 1) || w & (w - 1))
target = GL_TEXTURE_RECTANGLE_ARB;
else
target = GL_TEXTURE_2D;
}
pGlxDraw->target = target;
pGlxDraw->format = format;
}
| DoS Exec Code | 0 | determineTextureTarget(ClientPtr client, XID glxDrawableID,
CARD32 *attribs, CARD32 numAttribs)
{
GLenum target = 0;
GLenum format = 0;
int i, err;
__GLXdrawable *pGlxDraw;
if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
DixWriteAccess, &pGlxDraw, &err))
/* We just added it in CreatePixmap, so we should never get here. */
return;
for (i = 0; i < numAttribs; i++) {
if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
switch (attribs[2 * i + 1]) {
case GLX_TEXTURE_2D_EXT:
target = GL_TEXTURE_2D;
break;
case GLX_TEXTURE_RECTANGLE_EXT:
target = GL_TEXTURE_RECTANGLE_ARB;
break;
}
}
if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
format = attribs[2 * i + 1];
}
if (!target) {
int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
if (h & (h - 1) || w & (w - 1))
target = GL_TEXTURE_RECTANGLE_ARB;
else
target = GL_TEXTURE_2D;
}
pGlxDraw->target = target;
pGlxDraw->format = format;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,385 | validGlxContext(ClientPtr client, XID id, int access_mode,
__GLXcontext **context, int *err)
{
*err = dixLookupResourceByType((pointer *) context, id,
__glXContextRes, client, access_mode);
if (*err != Success) {
client->errorValue = id;
if (*err == BadValue)
*err = __glXError(GLXBadContext);
return FALSE;
}
return TRUE;
}
| DoS Exec Code | 0 | validGlxContext(ClientPtr client, XID id, int access_mode,
__GLXcontext **context, int *err)
{
*err = dixLookupResourceByType((pointer *) context, id,
__glXContextRes, client, access_mode);
if (*err != Success) {
client->errorValue = id;
if (*err == BadValue)
*err = __glXError(GLXBadContext);
return FALSE;
}
return TRUE;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,386 | validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
__GLXdrawable **drawable, int *err)
{
int rc;
rc = dixLookupResourceByType((pointer *) drawable, id,
__glXDrawableRes, client, access_mode);
if (rc != Success && rc != BadValue) {
*err = rc;
client->errorValue = id;
return FALSE;
}
/* If the ID of the glx drawable we looked up doesn't match the id
* we looked for, it's because we looked it up under the X
* drawable ID (see DoCreateGLXDrawable). */
if (rc == BadValue ||
(*drawable)->drawId != id ||
(type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
client->errorValue = id;
switch (type) {
case GLX_DRAWABLE_WINDOW:
*err = __glXError(GLXBadWindow);
return FALSE;
case GLX_DRAWABLE_PIXMAP:
*err = __glXError(GLXBadPixmap);
return FALSE;
case GLX_DRAWABLE_PBUFFER:
*err = __glXError(GLXBadPbuffer);
return FALSE;
case GLX_DRAWABLE_ANY:
*err = __glXError(GLXBadDrawable);
return FALSE;
}
}
return TRUE;
}
| DoS Exec Code | 0 | validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
__GLXdrawable **drawable, int *err)
{
int rc;
rc = dixLookupResourceByType((pointer *) drawable, id,
__glXDrawableRes, client, access_mode);
if (rc != Success && rc != BadValue) {
*err = rc;
client->errorValue = id;
return FALSE;
}
/* If the ID of the glx drawable we looked up doesn't match the id
* we looked for, it's because we looked it up under the X
* drawable ID (see DoCreateGLXDrawable). */
if (rc == BadValue ||
(*drawable)->drawId != id ||
(type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
client->errorValue = id;
switch (type) {
case GLX_DRAWABLE_WINDOW:
*err = __glXError(GLXBadWindow);
return FALSE;
case GLX_DRAWABLE_PIXMAP:
*err = __glXError(GLXBadPixmap);
return FALSE;
case GLX_DRAWABLE_PBUFFER:
*err = __glXError(GLXBadPbuffer);
return FALSE;
case GLX_DRAWABLE_ANY:
*err = __glXError(GLXBadDrawable);
return FALSE;
}
}
return TRUE;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,387 | validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
__GLXconfig **config, int *err)
{
__GLXconfig *m;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
if (m->fbconfigID == id) {
*config = m;
return TRUE;
}
client->errorValue = id;
*err = __glXError(GLXBadFBConfig);
return FALSE;
}
| DoS Exec Code | 0 | validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
__GLXconfig **config, int *err)
{
__GLXconfig *m;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
if (m->fbconfigID == id) {
*config = m;
return TRUE;
}
client->errorValue = id;
*err = __glXError(GLXBadFBConfig);
return FALSE;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,388 | validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
DrawablePtr pDraw, int *err)
{
ScreenPtr pScreen = pDraw->pScreen;
VisualPtr pVisual = NULL;
XID vid;
int i;
vid = wVisual((WindowPtr)pDraw);
for (i = 0; i < pScreen->numVisuals; i++) {
if (pScreen->visuals[i].vid == vid) {
pVisual = &pScreen->visuals[i];
break;
}
}
/* FIXME: What exactly should we check here... */
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
!(config->drawableType & GLX_WINDOW_BIT)) {
client->errorValue = pDraw->id;
*err = BadMatch;
return FALSE;
}
return TRUE;
}
| DoS Exec Code | 0 | validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
DrawablePtr pDraw, int *err)
{
ScreenPtr pScreen = pDraw->pScreen;
VisualPtr pVisual = NULL;
XID vid;
int i;
vid = wVisual((WindowPtr)pDraw);
for (i = 0; i < pScreen->numVisuals; i++) {
if (pScreen->visuals[i].vid == vid) {
pVisual = &pScreen->visuals[i];
break;
}
}
/* FIXME: What exactly should we check here... */
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
!(config->drawableType & GLX_WINDOW_BIT)) {
client->errorValue = pDraw->id;
*err = BadMatch;
return FALSE;
}
return TRUE;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,389 | validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
__GLXconfig **config, int *err)
{
int i;
for (i = 0; i < pGlxScreen->numVisuals; i++)
if (pGlxScreen->visuals[i]->visualID == id) {
*config = pGlxScreen->visuals[i];
return TRUE;
}
client->errorValue = id;
*err = BadValue;
return FALSE;
}
| DoS Exec Code | 0 | validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
__GLXconfig **config, int *err)
{
int i;
for (i = 0; i < pGlxScreen->numVisuals; i++)
if (pGlxScreen->visuals[i]->visualID == id) {
*config = pGlxScreen->visuals[i];
return TRUE;
}
client->errorValue = id;
*err = BadValue;
return FALSE;
}
| @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
/*
** Check if screen exists.
*/
- if (screen >= screenInfo.numScreens) {
+ if (screen < 0 || screen >= screenInfo.numScreens) {
client->errorValue = screen;
*err = BadValue;
return FALSE; | CWE-20 | null | null |
11,390 | MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base)
{
unsigned long i, nglyphs;
CARD8 chs[2]; /* the font index we are going after */
CharInfoPtr pci;
int rv; /* return value */
int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit;
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, FALSE) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, GLYPHPADBYTES) );
for (i=0; i < count; i++) {
chs[0] = (first + i) >> 8; /* high byte is first byte */
chs[1] = first + i;
(*pFont->get_glyphs)(pFont, 1, chs, (FontEncoding)encoding,
&nglyphs, &pci);
/*
** Define a display list containing just a glBitmap() call.
*/
CALL_NewList( GET_DISPATCH(), (list_base + i, GL_COMPILE) );
if (nglyphs ) {
rv = __glXMakeBitmapFromGlyph(pFont, pci);
if (rv) {
return rv;
}
}
CALL_EndList( GET_DISPATCH(), () );
}
return Success;
}
| DoS Exec Code | 0 | MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base)
{
unsigned long i, nglyphs;
CARD8 chs[2]; /* the font index we are going after */
CharInfoPtr pci;
int rv; /* return value */
int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit;
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, FALSE) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) );
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, GLYPHPADBYTES) );
for (i=0; i < count; i++) {
chs[0] = (first + i) >> 8; /* high byte is first byte */
chs[1] = first + i;
(*pFont->get_glyphs)(pFont, 1, chs, (FontEncoding)encoding,
&nglyphs, &pci);
/*
** Define a display list containing just a glBitmap() call.
*/
CALL_NewList( GET_DISPATCH(), (list_base + i, GL_COMPILE) );
if (nglyphs ) {
rv = __glXMakeBitmapFromGlyph(pFont, pci);
if (rv) {
return rv;
}
}
CALL_EndList( GET_DISPATCH(), () );
}
return Success;
}
| @@ -154,6 +154,8 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *cx;
int error;
+ REQUEST_SIZE_MATCH(xGLXUseXFontReq);
+
req = (xGLXUseXFontReq *) pc;
cx = __glXForceCurrent(cl, req->contextTag, &error);
if (!cx) { | CWE-20 | null | null |
11,391 | ZEND_METHOD(exception, __clone)
{
/* Should never be executable */
zend_throw_exception(NULL, "Cannot clone object using __clone()", 0 TSRMLS_CC);
}
| DoS | 0 | ZEND_METHOD(exception, __clone)
{
/* Should never be executable */
zend_throw_exception(NULL, "Cannot clone object using __clone()", 0 TSRMLS_CC);
}
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,392 | ZEND_METHOD(exception, __construct)
{
char *message = NULL;
long code = 0;
zval *object, *previous = NULL;
int argc = ZEND_NUM_ARGS(), message_len;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) {
zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])");
}
object = getThis();
if (message) {
zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
}
if (code) {
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
}
if (previous) {
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC);
}
}
| DoS | 0 | ZEND_METHOD(exception, __construct)
{
char *message = NULL;
long code = 0;
zval *object, *previous = NULL;
int argc = ZEND_NUM_ARGS(), message_len;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) {
zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])");
}
object = getThis();
if (message) {
zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
}
if (code) {
zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
}
if (previous) {
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC);
}
}
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,393 | ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
{
if (EG(prev_exception)) {
zval_ptr_dtor(&EG(prev_exception));
EG(prev_exception) = NULL;
}
if (!EG(exception)) {
return;
}
zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
EG(current_execute_data)->opline = EG(opline_before_exception);
#if ZEND_DEBUG
EG(opline_before_exception) = NULL;
#endif
}
/* }}} */
| DoS | 0 | ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
{
if (EG(prev_exception)) {
zval_ptr_dtor(&EG(prev_exception));
EG(prev_exception) = NULL;
}
if (!EG(exception)) {
return;
}
zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
EG(current_execute_data)->opline = EG(opline_before_exception);
#if ZEND_DEBUG
EG(opline_before_exception) = NULL;
#endif
}
/* }}} */
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,394 | static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 0 TSRMLS_CC);
}
/* }}} */
| DoS | 0 | static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 0 TSRMLS_CC);
}
/* }}} */
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,395 | static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
{
zval obj;
zend_object *object;
zval *trace;
Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC);
Z_OBJ_HT(obj) = &default_exception_handlers;
object_properties_init(object, class_type);
ALLOC_ZVAL(trace);
Z_UNSET_ISREF_P(trace);
Z_SET_REFCOUNT_P(trace, 0);
zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
return Z_OBJVAL(obj);
}
/* }}} */
| DoS | 0 | static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
{
zval obj;
zend_object *object;
zval *trace;
Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC);
Z_OBJ_HT(obj) = &default_exception_handlers;
object_properties_init(object, class_type);
ALLOC_ZVAL(trace);
Z_UNSET_ISREF_P(trace);
Z_SET_REFCOUNT_P(trace, 0);
zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
return Z_OBJVAL(obj);
}
/* }}} */
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,396 | static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC);
}
/* }}} */
| DoS | 0 | static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC);
}
/* }}} */
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,397 | void zend_exception_restore(TSRMLS_D) /* {{{ */
{
if (EG(prev_exception)) {
if (EG(exception)) {
zend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC);
} else {
EG(exception) = EG(prev_exception);
}
EG(prev_exception) = NULL;
}
}
/* }}} */
| DoS | 0 | void zend_exception_restore(TSRMLS_D) /* {{{ */
{
if (EG(prev_exception)) {
if (EG(exception)) {
zend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC);
} else {
EG(exception) = EG(prev_exception);
}
EG(prev_exception) = NULL;
}
}
/* }}} */
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,398 | void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
{
zval *previous;
if (exception == add_previous || !add_previous || !exception) {
return;
}
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot set non exception as previous exception");
return;
}
while (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) {
previous = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(previous) == IS_NULL) {
zend_update_property(default_exception_ce, exception, "previous", sizeof("previous")-1, add_previous TSRMLS_CC);
Z_DELREF_P(add_previous);
return;
}
exception = previous;
}
}
| DoS | 0 | void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
{
zval *previous;
if (exception == add_previous || !add_previous || !exception) {
return;
}
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot set non exception as previous exception");
return;
}
while (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) {
previous = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(previous) == IS_NULL) {
zend_update_property(default_exception_ce, exception, "previous", sizeof("previous")-1, add_previous TSRMLS_CC);
Z_DELREF_P(add_previous);
return;
}
exception = previous;
}
}
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
11,399 | void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
const char *classname;
zend_uint name_len;
if (exception != NULL) {
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
DTRACE_EXCEPTION_THROWN((char *)classname);
} else {
DTRACE_EXCEPTION_THROWN(NULL);
}
}
#endif /* HAVE_DTRACE */
if (exception != NULL) {
zval *previous = EG(exception);
zend_exception_set_previous(exception, EG(exception) TSRMLS_CC);
EG(exception) = exception;
if (previous) {
return;
}
}
if (!EG(current_execute_data)) {
if(EG(exception)) {
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
}
zend_error(E_ERROR, "Exception thrown without a stack frame");
}
if (zend_throw_exception_hook) {
zend_throw_exception_hook(exception TSRMLS_CC);
}
if (EG(current_execute_data)->opline == NULL ||
(EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
/* no need to rethrow the exception */
return;
}
EG(opline_before_exception) = EG(current_execute_data)->opline;
EG(current_execute_data)->opline = EG(exception_op);
}
/* }}} */
| DoS | 0 | void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
const char *classname;
zend_uint name_len;
if (exception != NULL) {
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
DTRACE_EXCEPTION_THROWN((char *)classname);
} else {
DTRACE_EXCEPTION_THROWN(NULL);
}
}
#endif /* HAVE_DTRACE */
if (exception != NULL) {
zval *previous = EG(exception);
zend_exception_set_previous(exception, EG(exception) TSRMLS_CC);
EG(exception) = exception;
if (previous) {
return;
}
}
if (!EG(current_execute_data)) {
if(EG(exception)) {
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
}
zend_error(E_ERROR, "Exception thrown without a stack frame");
}
if (zend_throw_exception_hook) {
zend_throw_exception_hook(exception TSRMLS_CC);
}
if (EG(current_execute_data)->opline == NULL ||
(EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
/* no need to rethrow the exception */
return;
}
EG(opline_before_exception) = EG(current_execute_data)->opline;
EG(current_execute_data)->opline = EG(exception_op);
}
/* }}} */
| @@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
}
/* }}} */
+/* {{{ proto Exception::__wakeup()
+ Exception unserialize checks */
+#define CHECK_EXC_TYPE(name, type) \
+ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
+ if(value && Z_TYPE_P(value) != type) { \
+ zval *tmp; \
+ MAKE_STD_ZVAL(tmp); \
+ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
+ Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
+ zval_ptr_dtor(&tmp); \
+ }
+
+ZEND_METHOD(exception, __wakeup)
+{
+ zval *value;
+ zval *object = getThis();
+ HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
+ CHECK_EXC_TYPE("message", IS_STRING);
+ CHECK_EXC_TYPE("string", IS_STRING);
+ CHECK_EXC_TYPE("code", IS_LONG);
+ CHECK_EXC_TYPE("file", IS_STRING);
+ CHECK_EXC_TYPE("line", IS_LONG);
+ CHECK_EXC_TYPE("trace", IS_ARRAY);
+ CHECK_EXC_TYPE("previous", IS_OBJECT);
+}
+/* }}} */
+
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
ErrorException constructor */
ZEND_METHOD(error_exception, __construct)
@@ -728,6 +755,7 @@ ZEND_END_ARG_INFO()
const static zend_function_entry default_exception_functions[] = {
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) | CWE-20 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.