Commit d1ca2119 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Mike DePaulo

Xv: unvalidated lengths in XVideo extension swapped procs [CVE-2014-8099]

v2: backport to nx-libs 3.6.x (Mike DePaulo) v3: port to NXxvdisp.c rather than xvdisp.c (Mike DePaulo) Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net> Conflicts: Xext/xvdisp.c
parent 4ed85e8e
...@@ -1423,6 +1423,7 @@ SProcXvQueryExtension(ClientPtr client) ...@@ -1423,6 +1423,7 @@ SProcXvQueryExtension(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvQueryExtensionReq); REQUEST(xvQueryExtensionReq);
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
return ProcXvQueryExtension(client); return ProcXvQueryExtension(client);
} }
...@@ -1432,6 +1433,7 @@ SProcXvQueryAdaptors(ClientPtr client) ...@@ -1432,6 +1433,7 @@ SProcXvQueryAdaptors(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvQueryAdaptorsReq); REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->window, n); swapl(&stuff->window, n);
return ProcXvQueryAdaptors(client); return ProcXvQueryAdaptors(client);
...@@ -1442,6 +1444,7 @@ SProcXvQueryEncodings(ClientPtr client) ...@@ -1442,6 +1444,7 @@ SProcXvQueryEncodings(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvQueryEncodingsReq); REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
return ProcXvQueryEncodings(client); return ProcXvQueryEncodings(client);
...@@ -1452,6 +1455,7 @@ SProcXvGrabPort(ClientPtr client) ...@@ -1452,6 +1455,7 @@ SProcXvGrabPort(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvGrabPortReq); REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->time, n); swapl(&stuff->time, n);
...@@ -1463,6 +1467,7 @@ SProcXvUngrabPort(ClientPtr client) ...@@ -1463,6 +1467,7 @@ SProcXvUngrabPort(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvUngrabPortReq); REQUEST(xvUngrabPortReq);
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->time, n); swapl(&stuff->time, n);
...@@ -1474,6 +1479,7 @@ SProcXvPutVideo(ClientPtr client) ...@@ -1474,6 +1479,7 @@ SProcXvPutVideo(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvPutVideoReq); REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1494,6 +1500,7 @@ SProcXvPutStill(ClientPtr client) ...@@ -1494,6 +1500,7 @@ SProcXvPutStill(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvPutStillReq); REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1514,6 +1521,7 @@ SProcXvGetVideo(ClientPtr client) ...@@ -1514,6 +1521,7 @@ SProcXvGetVideo(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvGetVideoReq); REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1534,6 +1542,7 @@ SProcXvGetStill(ClientPtr client) ...@@ -1534,6 +1542,7 @@ SProcXvGetStill(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvGetStillReq); REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1554,6 +1563,7 @@ SProcXvPutImage(ClientPtr client) ...@@ -1554,6 +1563,7 @@ SProcXvPutImage(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvPutImageReq); REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1578,6 +1588,7 @@ SProcXvShmPutImage(ClientPtr client) ...@@ -1578,6 +1588,7 @@ SProcXvShmPutImage(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvShmPutImageReq); REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1605,6 +1616,7 @@ SProcXvSelectVideoNotify(ClientPtr client) ...@@ -1605,6 +1616,7 @@ SProcXvSelectVideoNotify(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvSelectVideoNotifyReq); REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
return ProcXvSelectVideoNotify(client); return ProcXvSelectVideoNotify(client);
...@@ -1615,6 +1627,7 @@ SProcXvSelectPortNotify(ClientPtr client) ...@@ -1615,6 +1627,7 @@ SProcXvSelectPortNotify(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvSelectPortNotifyReq); REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
return ProcXvSelectPortNotify(client); return ProcXvSelectPortNotify(client);
...@@ -1625,6 +1638,7 @@ SProcXvStopVideo(ClientPtr client) ...@@ -1625,6 +1638,7 @@ SProcXvStopVideo(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvStopVideoReq); REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->drawable, n); swapl(&stuff->drawable, n);
...@@ -1636,6 +1650,7 @@ SProcXvSetPortAttribute(ClientPtr client) ...@@ -1636,6 +1650,7 @@ SProcXvSetPortAttribute(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvSetPortAttributeReq); REQUEST(xvSetPortAttributeReq);
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->attribute, n); swapl(&stuff->attribute, n);
...@@ -1647,6 +1662,7 @@ SProcXvGetPortAttribute(ClientPtr client) ...@@ -1647,6 +1662,7 @@ SProcXvGetPortAttribute(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvGetPortAttributeReq); REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swapl(&stuff->attribute, n); swapl(&stuff->attribute, n);
...@@ -1658,6 +1674,7 @@ SProcXvQueryBestSize(ClientPtr client) ...@@ -1658,6 +1674,7 @@ SProcXvQueryBestSize(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvQueryBestSizeReq); REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
swaps(&stuff->vid_w, n); swaps(&stuff->vid_w, n);
...@@ -1672,6 +1689,7 @@ SProcXvQueryPortAttributes(ClientPtr client) ...@@ -1672,6 +1689,7 @@ SProcXvQueryPortAttributes(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvQueryPortAttributesReq); REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
return ProcXvQueryPortAttributes(client); return ProcXvQueryPortAttributes(client);
...@@ -1682,6 +1700,7 @@ SProcXvQueryImageAttributes(ClientPtr client) ...@@ -1682,6 +1700,7 @@ SProcXvQueryImageAttributes(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvQueryImageAttributesReq); REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->id, n); swapl(&stuff->id, n);
swaps(&stuff->width, n); swaps(&stuff->width, n);
...@@ -1694,6 +1713,7 @@ SProcXvListImageFormats(ClientPtr client) ...@@ -1694,6 +1713,7 @@ SProcXvListImageFormats(ClientPtr client)
{ {
register char n; register char n;
REQUEST(xvListImageFormatsReq); REQUEST(xvListImageFormatsReq);
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->port, n); swapl(&stuff->port, n);
return ProcXvListImageFormats(client); return ProcXvListImageFormats(client);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment