Lines 41-46
Link Here
|
41 |
#include <dix-config.h> |
41 |
#include <dix-config.h> |
42 |
#endif |
42 |
#endif |
43 |
|
43 |
|
|
|
44 |
#if HAVE_STDINT_T |
45 |
#include <stdint.h> |
46 |
#elif !defined(UINT32_MAX) |
47 |
#define UINT32_MAX 0xffffffffU |
48 |
#endif |
49 |
|
44 |
#include <X11/X.h> |
50 |
#include <X11/X.h> |
45 |
#include <X11/Xproto.h> |
51 |
#include <X11/Xproto.h> |
46 |
#include "scrnintstr.h" |
52 |
#include "scrnintstr.h" |
Lines 733-743
ProcDbeSwapBuffers(client)
Link Here
|
733 |
return(Success); |
739 |
return(Success); |
734 |
} |
740 |
} |
735 |
|
741 |
|
|
|
742 |
if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec)) |
743 |
return BadAlloc; |
744 |
|
736 |
/* Get to the swap info appended to the end of the request. */ |
745 |
/* Get to the swap info appended to the end of the request. */ |
737 |
dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; |
746 |
dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; |
738 |
|
747 |
|
739 |
/* Allocate array to record swap information. */ |
748 |
/* Allocate array to record swap information. */ |
740 |
swapInfo = (DbeSwapInfoPtr)ALLOCATE_LOCAL(nStuff * sizeof(DbeSwapInfoRec)); |
749 |
swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec)); |
741 |
if (swapInfo == NULL) |
750 |
if (swapInfo == NULL) |
742 |
{ |
751 |
{ |
743 |
return(BadAlloc); |
752 |
return(BadAlloc); |
Lines 752-765
ProcDbeSwapBuffers(client)
Link Here
|
752 |
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, |
761 |
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, |
753 |
SecurityWriteAccess))) |
762 |
SecurityWriteAccess))) |
754 |
{ |
763 |
{ |
755 |
DEALLOCATE_LOCAL(swapInfo); |
764 |
Xfree(swapInfo); |
756 |
return(BadWindow); |
765 |
return(BadWindow); |
757 |
} |
766 |
} |
758 |
|
767 |
|
759 |
/* Each window must be double-buffered - BadMatch. */ |
768 |
/* Each window must be double-buffered - BadMatch. */ |
760 |
if (DBE_WINDOW_PRIV(pWin) == NULL) |
769 |
if (DBE_WINDOW_PRIV(pWin) == NULL) |
761 |
{ |
770 |
{ |
762 |
DEALLOCATE_LOCAL(swapInfo); |
771 |
Xfree(swapInfo); |
763 |
return(BadMatch); |
772 |
return(BadMatch); |
764 |
} |
773 |
} |
765 |
|
774 |
|
Lines 768-774
ProcDbeSwapBuffers(client)
Link Here
|
768 |
{ |
777 |
{ |
769 |
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) |
778 |
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) |
770 |
{ |
779 |
{ |
771 |
DEALLOCATE_LOCAL(swapInfo); |
780 |
Xfree(swapInfo); |
772 |
return(BadMatch); |
781 |
return(BadMatch); |
773 |
} |
782 |
} |
774 |
} |
783 |
} |
Lines 779-785
ProcDbeSwapBuffers(client)
Link Here
|
779 |
(dbeSwapInfo[i].swapAction != XdbeUntouched ) && |
788 |
(dbeSwapInfo[i].swapAction != XdbeUntouched ) && |
780 |
(dbeSwapInfo[i].swapAction != XdbeCopied )) |
789 |
(dbeSwapInfo[i].swapAction != XdbeCopied )) |
781 |
{ |
790 |
{ |
782 |
DEALLOCATE_LOCAL(swapInfo); |
791 |
Xfree(swapInfo); |
783 |
return(BadValue); |
792 |
return(BadValue); |
784 |
} |
793 |
} |
785 |
|
794 |
|
Lines 809-820
ProcDbeSwapBuffers(client)
Link Here
|
809 |
error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); |
818 |
error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); |
810 |
if (error != Success) |
819 |
if (error != Success) |
811 |
{ |
820 |
{ |
812 |
DEALLOCATE_LOCAL(swapInfo); |
821 |
Xfree(swapInfo); |
813 |
return(error); |
822 |
return(error); |
814 |
} |
823 |
} |
815 |
} |
824 |
} |
816 |
|
825 |
|
817 |
DEALLOCATE_LOCAL(swapInfo); |
826 |
Xfree(swapInfo); |
818 |
return(Success); |
827 |
return(Success); |
819 |
|
828 |
|
820 |
} /* ProcDbeSwapBuffers() */ |
829 |
} /* ProcDbeSwapBuffers() */ |
Lines 898-907
ProcDbeGetVisualInfo(client)
Link Here
|
898 |
|
907 |
|
899 |
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); |
908 |
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); |
900 |
|
909 |
|
|
|
910 |
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr)) |
911 |
return BadAlloc; |
901 |
/* Make sure any specified drawables are valid. */ |
912 |
/* Make sure any specified drawables are valid. */ |
902 |
if (stuff->n != 0) |
913 |
if (stuff->n != 0) |
903 |
{ |
914 |
{ |
904 |
if (!(pDrawables = (DrawablePtr *)ALLOCATE_LOCAL(stuff->n * |
915 |
if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n * |
905 |
sizeof(DrawablePtr)))) |
916 |
sizeof(DrawablePtr)))) |
906 |
{ |
917 |
{ |
907 |
return(BadAlloc); |
918 |
return(BadAlloc); |
Lines 914-920
ProcDbeGetVisualInfo(client)
Link Here
|
914 |
if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( |
925 |
if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( |
915 |
drawables[i], client, SecurityReadAccess))) |
926 |
drawables[i], client, SecurityReadAccess))) |
916 |
{ |
927 |
{ |
917 |
DEALLOCATE_LOCAL(pDrawables); |
928 |
Xfree(pDrawables); |
918 |
return(BadDrawable); |
929 |
return(BadDrawable); |
919 |
} |
930 |
} |
920 |
} |
931 |
} |
Lines 926-932
ProcDbeGetVisualInfo(client)
Link Here
|
926 |
{ |
937 |
{ |
927 |
if (pDrawables) |
938 |
if (pDrawables) |
928 |
{ |
939 |
{ |
929 |
DEALLOCATE_LOCAL(pDrawables); |
940 |
Xfree(pDrawables); |
930 |
} |
941 |
} |
931 |
|
942 |
|
932 |
return(BadAlloc); |
943 |
return(BadAlloc); |
Lines 953-959
ProcDbeGetVisualInfo(client)
Link Here
|
953 |
/* Free pDrawables if we needed to allocate it above. */ |
964 |
/* Free pDrawables if we needed to allocate it above. */ |
954 |
if (pDrawables) |
965 |
if (pDrawables) |
955 |
{ |
966 |
{ |
956 |
DEALLOCATE_LOCAL(pDrawables); |
967 |
Xfree(pDrawables); |
957 |
} |
968 |
} |
958 |
|
969 |
|
959 |
return(BadAlloc); |
970 |
return(BadAlloc); |
Lines 1034-1040
ProcDbeGetVisualInfo(client)
Link Here
|
1034 |
|
1045 |
|
1035 |
if (pDrawables) |
1046 |
if (pDrawables) |
1036 |
{ |
1047 |
{ |
1037 |
DEALLOCATE_LOCAL(pDrawables); |
1048 |
Xfree(pDrawables); |
1038 |
} |
1049 |
} |
1039 |
|
1050 |
|
1040 |
return(client->noClientException); |
1051 |
return(client->noClientException); |