[vlc-commits] mpeg4audio: Fix a crash with some invalid streams.
Hugo Beauzée-Luyssen
git at videolan.org
Sat Apr 21 19:43:54 CEST 2012
vlc/vlc-2.0 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Apr 17 14:29:35 2012 +0200| [b144e25cfec4fdc7a06ef7f5ac86735b9a8e75e7] | committer: Jean-Baptiste Kempf
mpeg4audio: Fix a crash with some invalid streams.
If rate stays at 0, a FPE will be raised in SetupOutput.
(cherry picked from commit f5bc59c5a6f1b63d6468ba2d483252ecc6010801)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=b144e25cfec4fdc7a06ef7f5ac86735b9a8e75e7
---
modules/packetizer/mpeg4audio.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 6214080..5cbc01f 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -808,20 +808,23 @@ static int LOASParse( decoder_t *p_dec, uint8_t *p_buffer, int i_buffer )
p_sys->i_rate = st->cfg.i_samplerate;
p_sys->i_frame_length = st->cfg.i_frame_length;
- /* FIXME And if it changes ? */
- if( !p_dec->fmt_out.i_extra && st->i_extra > 0 )
+ if ( p_sys->i_channels > 0 && p_sys->i_rate > 0 &&
+ p_sys->i_frame_length > 0 )
{
- p_dec->fmt_out.i_extra = st->i_extra;
- p_dec->fmt_out.p_extra = malloc( st->i_extra );
- if( !p_dec->fmt_out.p_extra )
+ /* FIXME And if it changes ? */
+ if( !p_dec->fmt_out.i_extra && st->i_extra > 0 )
{
- p_dec->fmt_out.i_extra = 0;
- return 0;
+ p_dec->fmt_out.i_extra = st->i_extra;
+ p_dec->fmt_out.p_extra = malloc( st->i_extra );
+ if( !p_dec->fmt_out.p_extra )
+ {
+ p_dec->fmt_out.i_extra = 0;
+ return 0;
+ }
+ memcpy( p_dec->fmt_out.p_extra, st->extra, st->i_extra );
}
- memcpy( p_dec->fmt_out.p_extra, st->extra, st->i_extra );
+ p_sys->b_latm_cfg = true;
}
-
- p_sys->b_latm_cfg = true;
}
}
/* Wait for the configuration */
More information about the vlc-commits
mailing list