Lines 39-44
Link Here
|
39 |
#endif |
39 |
#endif |
40 |
|
40 |
|
41 |
#include <string.h> |
41 |
#include <string.h> |
|
|
42 |
#if HAVE_STDINT_T |
43 |
#include <stdint.h> |
44 |
#elif !defined(UINT32_MAX) |
45 |
#define UINT32_MAX 0xffffffffU |
46 |
#endif |
42 |
|
47 |
|
43 |
#include <X11/X.h> |
48 |
#include <X11/X.h> |
44 |
#include <X11/Xproto.h> |
49 |
#include <X11/Xproto.h> |
Lines 713-723
ProcDbeSwapBuffers(ClientPtr client)
Link Here
|
713 |
return(Success); |
718 |
return(Success); |
714 |
} |
719 |
} |
715 |
|
720 |
|
|
|
721 |
if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec)) |
722 |
return BadAlloc; |
723 |
|
716 |
/* Get to the swap info appended to the end of the request. */ |
724 |
/* Get to the swap info appended to the end of the request. */ |
717 |
dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; |
725 |
dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; |
718 |
|
726 |
|
719 |
/* Allocate array to record swap information. */ |
727 |
/* Allocate array to record swap information. */ |
720 |
swapInfo = (DbeSwapInfoPtr)ALLOCATE_LOCAL(nStuff * sizeof(DbeSwapInfoRec)); |
728 |
swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec)); |
721 |
if (swapInfo == NULL) |
729 |
if (swapInfo == NULL) |
722 |
{ |
730 |
{ |
723 |
return(BadAlloc); |
731 |
return(BadAlloc); |
Lines 732-745
ProcDbeSwapBuffers(ClientPtr client)
Link Here
|
732 |
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, |
740 |
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, |
733 |
SecurityWriteAccess))) |
741 |
SecurityWriteAccess))) |
734 |
{ |
742 |
{ |
735 |
DEALLOCATE_LOCAL(swapInfo); |
743 |
Xfree(swapInfo); |
736 |
return(BadWindow); |
744 |
return(BadWindow); |
737 |
} |
745 |
} |
738 |
|
746 |
|
739 |
/* Each window must be double-buffered - BadMatch. */ |
747 |
/* Each window must be double-buffered - BadMatch. */ |
740 |
if (DBE_WINDOW_PRIV(pWin) == NULL) |
748 |
if (DBE_WINDOW_PRIV(pWin) == NULL) |
741 |
{ |
749 |
{ |
742 |
DEALLOCATE_LOCAL(swapInfo); |
750 |
Xfree(swapInfo); |
743 |
return(BadMatch); |
751 |
return(BadMatch); |
744 |
} |
752 |
} |
745 |
|
753 |
|
Lines 748-754
ProcDbeSwapBuffers(ClientPtr client)
Link Here
|
748 |
{ |
756 |
{ |
749 |
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) |
757 |
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) |
750 |
{ |
758 |
{ |
751 |
DEALLOCATE_LOCAL(swapInfo); |
759 |
Xfree(swapInfo); |
752 |
return(BadMatch); |
760 |
return(BadMatch); |
753 |
} |
761 |
} |
754 |
} |
762 |
} |
Lines 759-765
ProcDbeSwapBuffers(ClientPtr client)
Link Here
|
759 |
(dbeSwapInfo[i].swapAction != XdbeUntouched ) && |
767 |
(dbeSwapInfo[i].swapAction != XdbeUntouched ) && |
760 |
(dbeSwapInfo[i].swapAction != XdbeCopied )) |
768 |
(dbeSwapInfo[i].swapAction != XdbeCopied )) |
761 |
{ |
769 |
{ |
762 |
DEALLOCATE_LOCAL(swapInfo); |
770 |
Xfree(swapInfo); |
763 |
return(BadValue); |
771 |
return(BadValue); |
764 |
} |
772 |
} |
765 |
|
773 |
|
Lines 789-800
ProcDbeSwapBuffers(ClientPtr client)
Link Here
|
789 |
error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); |
797 |
error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); |
790 |
if (error != Success) |
798 |
if (error != Success) |
791 |
{ |
799 |
{ |
792 |
DEALLOCATE_LOCAL(swapInfo); |
800 |
Xfree(swapInfo); |
793 |
return(error); |
801 |
return(error); |
794 |
} |
802 |
} |
795 |
} |
803 |
} |
796 |
|
804 |
|
797 |
DEALLOCATE_LOCAL(swapInfo); |
805 |
Xfree(swapInfo); |
798 |
return(Success); |
806 |
return(Success); |
799 |
|
807 |
|
800 |
} /* ProcDbeSwapBuffers() */ |
808 |
} /* ProcDbeSwapBuffers() */ |
Lines 876-885
ProcDbeGetVisualInfo(ClientPtr client)
Link Here
|
876 |
|
884 |
|
877 |
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); |
885 |
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); |
878 |
|
886 |
|
|
|
887 |
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr)) |
888 |
return BadAlloc; |
879 |
/* Make sure any specified drawables are valid. */ |
889 |
/* Make sure any specified drawables are valid. */ |
880 |
if (stuff->n != 0) |
890 |
if (stuff->n != 0) |
881 |
{ |
891 |
{ |
882 |
if (!(pDrawables = (DrawablePtr *)ALLOCATE_LOCAL(stuff->n * |
892 |
if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n * |
883 |
sizeof(DrawablePtr)))) |
893 |
sizeof(DrawablePtr)))) |
884 |
{ |
894 |
{ |
885 |
return(BadAlloc); |
895 |
return(BadAlloc); |
Lines 892-898
ProcDbeGetVisualInfo(ClientPtr client)
Link Here
|
892 |
if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( |
902 |
if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( |
893 |
drawables[i], client, SecurityReadAccess))) |
903 |
drawables[i], client, SecurityReadAccess))) |
894 |
{ |
904 |
{ |
895 |
DEALLOCATE_LOCAL(pDrawables); |
905 |
Xfree(pDrawables); |
896 |
return(BadDrawable); |
906 |
return(BadDrawable); |
897 |
} |
907 |
} |
898 |
} |
908 |
} |
Lines 904-910
ProcDbeGetVisualInfo(ClientPtr client)
Link Here
|
904 |
{ |
914 |
{ |
905 |
if (pDrawables) |
915 |
if (pDrawables) |
906 |
{ |
916 |
{ |
907 |
DEALLOCATE_LOCAL(pDrawables); |
917 |
Xfree(pDrawables); |
908 |
} |
918 |
} |
909 |
|
919 |
|
910 |
return(BadAlloc); |
920 |
return(BadAlloc); |
Lines 931-937
ProcDbeGetVisualInfo(ClientPtr client)
Link Here
|
931 |
/* Free pDrawables if we needed to allocate it above. */ |
941 |
/* Free pDrawables if we needed to allocate it above. */ |
932 |
if (pDrawables) |
942 |
if (pDrawables) |
933 |
{ |
943 |
{ |
934 |
DEALLOCATE_LOCAL(pDrawables); |
944 |
Xfree(pDrawables); |
935 |
} |
945 |
} |
936 |
|
946 |
|
937 |
return(BadAlloc); |
947 |
return(BadAlloc); |
Lines 1012-1018
ProcDbeGetVisualInfo(ClientPtr client)
Link Here
|
1012 |
|
1022 |
|
1013 |
if (pDrawables) |
1023 |
if (pDrawables) |
1014 |
{ |
1024 |
{ |
1015 |
DEALLOCATE_LOCAL(pDrawables); |
1025 |
Xfree(pDrawables); |
1016 |
} |
1026 |
} |
1017 |
|
1027 |
|
1018 |
return(client->noClientException); |
1028 |
return(client->noClientException); |