[FFmpeg-cvslog] bitstream: fix a crash in case of oom

Piotr Bandurski git at videolan.org
Tue Jul 9 19:49:17 CEST 2013


ffmpeg | branch: master | Piotr Bandurski <ami_stuff at o2.pl> | Tue Jul  9 19:29:26 2013 +0200| [aa74810fc6b9afe21c9be3725e3d078d10633670] | committer: Michael Niedermayer

bitstream: fix a crash in case of oom

fixes ticket #2766

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/bitstream.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 23bea43..bbd9491 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -299,6 +299,8 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
     av_dlog(NULL, "build table nb_codes=%d\n", nb_codes);
 
     buf = av_malloc((nb_codes + 1) * sizeof(VLCcode));
+    if (!buf)
+        return AVERROR(ENOMEM);
 
     av_assert0(symbols_size <= 2 || !symbols);
     j = 0;



More information about the ffmpeg-cvslog mailing list