[vlc-commits] flac: fix decoding samples with too large extradata
Rafaël Carré
git at videolan.org
Tue Jul 2 18:27:21 CEST 2013
vlc/vlc-2.1 | branch: master | Rafaël Carré <funman at videolan.org> | Tue Jul 2 11:39:42 2013 +0200| [17af2ee97ea435cff2c4b4f2c4e574885d852435] | committer: Jean-Baptiste Kempf
flac: fix decoding samples with too large extradata
Only use the first 34 or 42 bytes (streaminfo block)
Sample:
0109c7dd02be4e673824fe156bc4cb66 [UTW-THORA] Evangelion 3.33 You Can (Not) Redo [BD][1080p,x264,flac][F2060CF5] sample.mka
(cherry picked from commit ac636adefd0543904475e68d619e127950be990d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=17af2ee97ea435cff2c4b4f2c4e574885d852435
---
modules/codec/flac.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 1002ffd..6dac9cc 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -381,11 +381,18 @@ static void ProcessHeader( decoder_t *p_dec )
/* Decode STREAMINFO */
msg_Dbg( p_dec, "decode STREAMINFO" );
size_t i_extra = p_dec->fmt_in.i_extra;
+ static const char header[4] = { 'f', 'L', 'a', 'C' };
+
+ if (i_extra > 42 && !memcmp(p_dec->fmt_in.p_extra, header, 4))
+ i_extra = 42;
+ else if (i_extra > 34 && memcmp(p_dec->fmt_in.p_extra, header, 4))
+ i_extra = 34;
+
switch (i_extra) {
case 34:
p_sys->p_block = block_Alloc( 8 + i_extra );
memcpy( p_sys->p_block->p_buffer + 8, p_dec->fmt_in.p_extra, i_extra );
- memcpy( p_sys->p_block->p_buffer, "fLaC", 4);
+ memcpy( p_sys->p_block->p_buffer, header, 4);
uint8_t *p = p_sys->p_block->p_buffer;
p[4] = 0x80 | 0; /* STREAMINFO faked as last block */
p[5] = 0;
More information about the vlc-commits
mailing list