vlc | branch: master | Francois Cartegnie <[email protected]> | Mon Oct 21 
18:15:13 2019 +0200| [51bd5ed7425a1091aca239dd71833546d41eadc2] | committer: 
Francois Cartegnie

mux: libmp4: check max samples

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

 modules/mux/mp4/libmp4mux.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index 86df78bd82..c98733df91 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -196,8 +196,11 @@ bool mp4mux_track_AddSample(mp4mux_trackinfo_t *t, const 
mp4mux_sample_t *entry)
     /* XXX: -1 to always have 2 entry for easy adding of empty SPU */
     if (t->i_samples_count + 2 >= t->i_samples_max)
     {
-        mp4mux_sample_t *p_realloc =
-                realloc(t->samples, sizeof(*p_realloc) * (t->i_samples_max + 
1000));
+        if(t->i_samples_max + 1000 < t->i_samples_max)
+            return false;
+        mp4mux_sample_t *p_realloc = vlc_reallocarray(t->samples,
+                                                      t->i_samples_max + 1000,
+                                                      sizeof(*p_realloc));
         if(!p_realloc)
             return false;
         t->samples = p_realloc;

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to