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

Fabian Yamaguchi git at videolan.org
Thu Jan 22 14:31:38 CET 2015


vlc/vlc-2.1 | branch: master | Fabian Yamaguchi <fyamagu at gwdg.de> | Fri Dec  5 15:37:05 2014 +0100| [4e6137bbcd3d74630aa6f0e8b8b5b8aa0c19647d] | 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>
(cherry picked from commit 229c385a79d48e41687fae8b4dfeaeef9c8c3eb7)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 6595f70..dd1fbbc 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -1310,6 +1310,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