aboutsummaryrefslogtreecommitdiff
path: root/pixman/pixman/pixman-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'pixman/pixman/pixman-utils.c')
-rw-r--r--pixman/pixman/pixman-utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pixman/pixman/pixman-utils.c b/pixman/pixman/pixman-utils.c
index 98723a800..4a3a835c4 100644
--- a/pixman/pixman/pixman-utils.c
+++ b/pixman/pixman/pixman-utils.c
@@ -49,6 +49,15 @@ _pixman_addition_overflows_int (unsigned int a, unsigned int b)
}
void *
+pixman_malloc_ab_plus_c (unsigned int a, unsigned int b, unsigned int c)
+{
+ if (!b || a >= INT32_MAX / b || (a * b) > INT32_MAX - c)
+ return NULL;
+
+ return malloc (a * b + c);
+}
+
+void *
pixman_malloc_ab (unsigned int a,
unsigned int b)
{