[vlc-commits] codec: dmo: avoid null-pointer dereference.

Fabian Yamaguchi git at videolan.org
Sat Dec 6 18:50:48 CET 2014


vlc | branch: master | Fabian Yamaguchi <fyamagu at gwdg.de> | Fri Dec  5 15:37:05 2014 +0100| [229c385a79d48e41687fae8b4dfeaeef9c8c3eb7] | committer: Jean-Baptiste Kempf

codec: dmo: avoid null-pointer dereference.

Check the return value of malloc to avoid a null-pointer dereference.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/dmo/dmo.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 351ff19..25a1f73 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -1324,6 +1324,9 @@ static int EncoderSetAudioType( encoder_t *p_enc, IMediaObject *p_dmo )
         msg_Dbg( p_enc, "found cbSize: %i", p_wf->cbSize );
         p_enc->fmt_out.i_extra = p_wf->cbSize;
         p_enc->fmt_out.p_extra = malloc( p_enc->fmt_out.i_extra );
+        if( p_enc->fmt_out.p_extra == NULL)
+            return VLC_EGENERIC;
+
         memcpy( p_enc->fmt_out.p_extra, &p_wf[1], p_enc->fmt_out.i_extra );
     }
 



More information about the vlc-commits mailing list