[vlc-commits] MKV: reject invalid real audio data

Jean-Baptiste Kempf git at videolan.org
Fri Apr 13 14:52:41 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Apr 13 14:13:05 2012 +0200| [11489bdb9d597f307b938711554596534a29cbf6] | committer: Jean-Baptiste Kempf

MKV: reject invalid real audio data

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

 modules/demux/mkv/matroska_segment.cpp |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 51b9587..361e413 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1262,17 +1262,24 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                 p_fmt->audio.i_rate = 8000;
                 p_fmt->audio.i_blockalign = 0x14;
             }
-            else
+            else if( p_tk->i_extra_data > 28 )
             {
-                if( !strcmp( p_tk->psz_codec, "A_REAL/COOK" ) )
-                    p_tk->fmt.i_codec = VLC_CODEC_COOK;
-                else if( !strcmp( p_tk->psz_codec, "A_REAL/ATRC" ) )
-                    p_tk->fmt.i_codec = VLC_CODEC_ATRAC3;
-                else if( !strcmp( p_tk->psz_codec, "A_REAL/28_8" ) )
-                    p_tk->fmt.i_codec = VLC_CODEC_RA_288;
-                /* FIXME RALF and SIPR */
-
-                fill_extra_data( p_tk, p_tk->fmt.i_codec == VLC_CODEC_RA_288 ? 0 : 78);
+                uint8_t *p = p_tk->p_extra_data;
+                if( memcmp( p, ".ra", 3 ) ) {
+                    msg_Err( &sys.demuxer, "Invalid Real ExtraData 0x%4.4s", (char *)p );
+                    p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' );
+                }
+                else {
+                    if( !strcmp( p_tk->psz_codec, "A_REAL/COOK" ) )
+                        p_tk->fmt.i_codec = VLC_CODEC_COOK;
+                    else if( !strcmp( p_tk->psz_codec, "A_REAL/ATRC" ) )
+                        p_tk->fmt.i_codec = VLC_CODEC_ATRAC3;
+                    else if( !strcmp( p_tk->psz_codec, "A_REAL/28_8" ) )
+                        p_tk->fmt.i_codec = VLC_CODEC_RA_288;
+                    /* FIXME RALF and SIPR */
+
+                    fill_extra_data( p_tk, p_tk->fmt.i_codec == VLC_CODEC_RA_288 ? 0 : 78);
+                }
             }
         }
         else if( !strcmp( p_tk->psz_codec, "S_KATE" ) )



More information about the vlc-commits mailing list