[vlc-commits] mux: mp4: check realloc

Francois Cartegnie git at videolan.org
Sun Aug 14 21:25:55 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Aug 14 21:23:36 2016 +0200| [c79bc234055d66d489aa29666ae94483e0f486ce] | committer: Francois Cartegnie

mux: mp4: check realloc

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

 modules/mux/mp4/libmp4mux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index e18cbd0..c3326cd 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -120,7 +120,8 @@ void box_gather (bo_t *box, bo_t *box2)
         box_fix(box2, box2->b->i_buffer);
         size_t i_offset = box->b->i_buffer;
         box->b = block_Realloc(box->b, 0, box->b->i_buffer + box2->b->i_buffer);
-        memcpy(&box->b->p_buffer[i_offset], box2->b->p_buffer, box2->b->i_buffer);
+        if(likely(box->b))
+            memcpy(&box->b->p_buffer[i_offset], box2->b->p_buffer, box2->b->i_buffer);
     }
     bo_free(box2);
 }



More information about the vlc-commits mailing list