changing ALLOCATE_LOCAL to xalloc to prevent stack overflow
This commit is contained in:
parent
b1764ddf13
commit
6e4f5cf83f
|
@ -919,7 +919,7 @@ ProcQueryTree(ClientPtr client)
|
||||||
{
|
{
|
||||||
int curChild = 0;
|
int curChild = 0;
|
||||||
|
|
||||||
childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
|
childIDs = (Window *) xalloc(numChildren * sizeof(Window));
|
||||||
if (!childIDs)
|
if (!childIDs)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
|
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
|
||||||
|
@ -934,7 +934,7 @@ ProcQueryTree(ClientPtr client)
|
||||||
{
|
{
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
|
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
|
||||||
DEALLOCATE_LOCAL(childIDs);
|
xfree(childIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
|
@ -1402,7 +1402,7 @@ ProcQueryFont(ClientPtr client)
|
||||||
rlength = sizeof(xQueryFontReply) +
|
rlength = sizeof(xQueryFontReply) +
|
||||||
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
|
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
|
||||||
nprotoxcistructs * sizeof(xCharInfo);
|
nprotoxcistructs * sizeof(xCharInfo);
|
||||||
reply = (xQueryFontReply *)ALLOCATE_LOCAL(rlength);
|
reply = (xQueryFontReply *)xalloc(rlength);
|
||||||
if(!reply)
|
if(!reply)
|
||||||
{
|
{
|
||||||
return(BadAlloc);
|
return(BadAlloc);
|
||||||
|
@ -1414,7 +1414,7 @@ ProcQueryFont(ClientPtr client)
|
||||||
QueryFont( pFont, reply, nprotoxcistructs);
|
QueryFont( pFont, reply, nprotoxcistructs);
|
||||||
|
|
||||||
WriteReplyToClient(client, rlength, reply);
|
WriteReplyToClient(client, rlength, reply);
|
||||||
DEALLOCATE_LOCAL(reply);
|
xfree(reply);
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2260,7 +2260,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
|
||||||
length += widthBytesLine;
|
length += widthBytesLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!(pBuf = (char *) ALLOCATE_LOCAL(length)))
|
if(!(pBuf = (char *) xalloc(length)))
|
||||||
return (BadAlloc);
|
return (BadAlloc);
|
||||||
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
|
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
|
||||||
}
|
}
|
||||||
|
@ -2362,7 +2362,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
|
||||||
if (pVisibleRegion)
|
if (pVisibleRegion)
|
||||||
REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
|
REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
|
||||||
if (!im_return)
|
if (!im_return)
|
||||||
DEALLOCATE_LOCAL(pBuf);
|
xfree(pBuf);
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2619,7 +2619,7 @@ ProcListInstalledColormaps(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
preply = (xListInstalledColormapsReply *)
|
preply = (xListInstalledColormapsReply *)
|
||||||
ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +
|
xalloc(sizeof(xListInstalledColormapsReply) +
|
||||||
pWin->drawable.pScreen->maxInstalledCmaps *
|
pWin->drawable.pScreen->maxInstalledCmaps *
|
||||||
sizeof(Colormap));
|
sizeof(Colormap));
|
||||||
if(!preply)
|
if(!preply)
|
||||||
|
@ -2634,7 +2634,7 @@ ProcListInstalledColormaps(ClientPtr client)
|
||||||
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
|
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
|
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
|
||||||
DEALLOCATE_LOCAL(preply);
|
xfree(preply);
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2761,7 +2761,7 @@ ProcAllocColorCells (ClientPtr client)
|
||||||
}
|
}
|
||||||
nmasks = stuff->planes;
|
nmasks = stuff->planes;
|
||||||
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
|
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
|
||||||
ppixels = (Pixel *)ALLOCATE_LOCAL(length);
|
ppixels = (Pixel *)xalloc(length);
|
||||||
if(!ppixels)
|
if(!ppixels)
|
||||||
return(BadAlloc);
|
return(BadAlloc);
|
||||||
pmasks = ppixels + npixels;
|
pmasks = ppixels + npixels;
|
||||||
|
@ -2769,7 +2769,7 @@ ProcAllocColorCells (ClientPtr client)
|
||||||
if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks,
|
if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks,
|
||||||
(Bool)stuff->contiguous, ppixels, pmasks)) )
|
(Bool)stuff->contiguous, ppixels, pmasks)) )
|
||||||
{
|
{
|
||||||
DEALLOCATE_LOCAL(ppixels);
|
xfree(ppixels);
|
||||||
if (client->noClientException != Success)
|
if (client->noClientException != Success)
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
else
|
else
|
||||||
|
@ -2788,7 +2788,7 @@ ProcAllocColorCells (ClientPtr client)
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, length, ppixels);
|
WriteSwappedDataToClient(client, length, ppixels);
|
||||||
}
|
}
|
||||||
DEALLOCATE_LOCAL(ppixels);
|
xfree(ppixels);
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2829,7 +2829,7 @@ ProcAllocColorPlanes(ClientPtr client)
|
||||||
acpr.sequenceNumber = client->sequence;
|
acpr.sequenceNumber = client->sequence;
|
||||||
acpr.nPixels = npixels;
|
acpr.nPixels = npixels;
|
||||||
length = (long)npixels * sizeof(Pixel);
|
length = (long)npixels * sizeof(Pixel);
|
||||||
ppixels = (Pixel *)ALLOCATE_LOCAL(length);
|
ppixels = (Pixel *)xalloc(length);
|
||||||
if(!ppixels)
|
if(!ppixels)
|
||||||
return(BadAlloc);
|
return(BadAlloc);
|
||||||
if( (retval = AllocColorPlanes(client->index, pcmp, npixels,
|
if( (retval = AllocColorPlanes(client->index, pcmp, npixels,
|
||||||
|
@ -2837,7 +2837,7 @@ ProcAllocColorPlanes(ClientPtr client)
|
||||||
(Bool)stuff->contiguous, ppixels,
|
(Bool)stuff->contiguous, ppixels,
|
||||||
&acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
|
&acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
|
||||||
{
|
{
|
||||||
DEALLOCATE_LOCAL(ppixels);
|
xfree(ppixels);
|
||||||
if (client->noClientException != Success)
|
if (client->noClientException != Success)
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
else
|
else
|
||||||
|
@ -2852,7 +2852,7 @@ ProcAllocColorPlanes(ClientPtr client)
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, length, ppixels);
|
WriteSwappedDataToClient(client, length, ppixels);
|
||||||
}
|
}
|
||||||
DEALLOCATE_LOCAL(ppixels);
|
xfree(ppixels);
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2981,12 +2981,12 @@ ProcQueryColors(ClientPtr client)
|
||||||
xQueryColorsReply qcr;
|
xQueryColorsReply qcr;
|
||||||
|
|
||||||
count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
|
count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
|
||||||
prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb));
|
prgbs = (xrgb *)xalloc(count * sizeof(xrgb));
|
||||||
if(!prgbs && count)
|
if(!prgbs && count)
|
||||||
return(BadAlloc);
|
return(BadAlloc);
|
||||||
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
|
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
|
||||||
{
|
{
|
||||||
if (prgbs) DEALLOCATE_LOCAL(prgbs);
|
if (prgbs) xfree(prgbs);
|
||||||
if (client->noClientException != Success)
|
if (client->noClientException != Success)
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
else
|
else
|
||||||
|
@ -3005,7 +3005,7 @@ ProcQueryColors(ClientPtr client)
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
|
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
|
||||||
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
|
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
|
||||||
}
|
}
|
||||||
if (prgbs) DEALLOCATE_LOCAL(prgbs);
|
if (prgbs) xfree(prgbs);
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue