[vlc-commits] objes: use multiplication overflow helper

Thomas Guillem git at videolan.org
Sun Nov 12 11:49:36 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Nov 12 11:42:34 2017 +0100| [e7a541237e34c07538d2db0155ae290088084634] | committer: Thomas Guillem

objes: use multiplication overflow helper

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e7a541237e34c07538d2db0155ae290088084634
---

 src/misc/objres.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/misc/objres.c b/src/misc/objres.c
index 7645cc2274..e7a299ba1a 100644
--- a/src/misc/objres.c
+++ b/src/misc/objres.c
@@ -136,9 +136,8 @@ static bool ptrcmp(void *a, void *b)
 static void *vlc_obj_alloc_common(vlc_object_t *obj, size_t nmemb, size_t size,
                                   bool do_memset)
 {
-    size_t tabsize = nmemb * size;
-
-    if (unlikely(tabsize < nmemb))
+    size_t tabsize;
+    if (mul_overflow(nmemb, size, &tabsize))
     {
         errno = ENOMEM;
         return NULL;



More information about the vlc-commits mailing list