[vlc-commits] mediacodec: p_block can change after a realloc

Thomas Guillem git at videolan.org
Thu May 26 11:57:10 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May 26 11:03:38 2016 +0200| [51bdb2c2c25febcbac49e9e076ab8613ae6aced6] | committer: Thomas Guillem

mediacodec: p_block can change after a realloc

This was not happening because blocks are allocated with a pre-padding of 32
bits. But this behavior could change in function of the packetizer or demuxer.

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

 modules/codec/omxil/mediacodec.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 6f67e92..0e34058 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -1580,7 +1580,8 @@ static int Video_OnNewBlock(decoder_t *p_dec, block_t **pp_block, int *p_flags)
     else if (p_dec->fmt_in.i_codec == VLC_CODEC_VC1)
     {
         /* Adding frame start code */
-        if (!block_Realloc(p_block, 4, p_block->i_buffer))
+        p_block = *pp_block = block_Realloc(p_block, 4, p_block->i_buffer);
+        if (p_block == NULL)
             return VLC_ENOMEM;
         p_block->p_buffer[0] = 0x00;
         p_block->p_buffer[1] = 0x00;



More information about the vlc-commits mailing list