[vlc-commits] objes: use multiplication overflow helper

Thomas Guillem git at videolan.org
Sun Nov 12 14:25:47 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Nov 12 11:42:34 2017 +0100| [051431cd65212319fd2f1272abcaeff6f04881c2] | committer: RĂ©mi Denis-Courmont

objes: use multiplication overflow helper

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

 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