summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Xv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Xv.c b/src/Xv.c
index 0a07d9d..f268f8e 100644
--- a/src/Xv.c
+++ b/src/Xv.c
@@ -992,7 +992,10 @@ XvImage * XvCreateImage (
return NULL;
}
- if((ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3)))) {
+ if (rep.num_planes < ((INT_MAX >> 3) - sizeof(XvImage)))
+ ret = Xmalloc(sizeof(XvImage) + (rep.num_planes << 3));
+
+ if (ret != NULL) {
ret->id = id;
ret->width = rep.width;
ret->height = rep.height;