[FFmpeg-devel] [PATCH] avformat/aiffdec: only read codec tag when header size is ample

Michael Niedermayer michaelni at gmx.at
Sun Jan 4 17:16:33 CET 2015


On Sun, Jan 04, 2015 at 10:48:01AM +1100, Peter Ross wrote:
> Signed-off-by: Peter Ross <pross at xvid.org>
> ---
>  libavformat/aiffdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
> index 91ef2a4..6271c3d 100644
> --- a/libavformat/aiffdec.c
> +++ b/libavformat/aiffdec.c
> @@ -116,13 +116,13 @@ static unsigned int get_aiff_header(AVFormatContext *s, int size,
>      size -= 18;
>  
>      /* get codec id for AIFF-C */
> -    if (version == AIFF_C_VERSION1) {
> +    if (version == AIFF_C_VERSION1 && size >= 4) {
>          codec->codec_tag = avio_rl32(pb);
>          codec->codec_id  = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
>          size -= 4;
>      }
>  
> -    if (version != AIFF_C_VERSION1 || codec->codec_id == AV_CODEC_ID_PCM_S16BE) {
> +    if (version != AIFF_C_VERSION1 || size < 4 || codec->codec_id == AV_CODEC_ID_PCM_S16BE) {
>          codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
>          codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
>          aiff->block_duration = 1;

breaks fate

codec-adpcm-swf
TEST    acodec-adpcm-yamaha
TEST    acodec-adpcm-adx-trellis
TEST    acodec-adpcm-ima_qt-trellis
TEST    acodec-adpcm-ima_wav-trellis
--- ./tests/ref/acodec/adpcm-ima_qt     2015-01-01 18:41:30.856529890 +0100
+++ tests/data/fate/acodec-adpcm-ima_qt 2015-01-04 16:59:31.301861602 +0100
@@ -1,4 +1,4 @@
 44691f14cf5bbef5005df27c692b93ab *tests/data/fate/acodec-adpcm-ima_qt.aiff
 281252 tests/data/fate/acodec-adpcm-ima_qt.aiff
-7d2f26ea48731b2399718de0f6c39f0c *tests/data/fate/acodec-adpcm-ima_qt.out.wav
-stddev:  904.76 PSNR: 37.20 MAXDIFF:34029 bytes:  1058400/  1058560
+b0e99866dd639791009c38e929ded60e *tests/data/fate/acodec-adpcm-ima_qt.out.wav
+stddev:19858.33 PSNR: 10.37 MAXDIFF:65514 bytes:  1058400/   562360
Test acodec-adpcm-ima_qt failed. Look at tests/data/fate/acodec-adpcm-ima_qt.err for details.
make: *** [fate-acodec-adpcm-ima_qt] Error 1
make: *** Waiting for unfinished jobs....
--- ./tests/ref/acodec/adpcm-ima_qt-trellis     2015-01-01 18:41:30.856529890 +0100
+++ tests/data/fate/acodec-adpcm-ima_qt-trellis 2015-01-04 16:59:31.977861616 +0100
@@ -1,4 +1,4 @@
 15f895c2e7119714f94333e3214d8426 *tests/data/fate/acodec-adpcm-ima_qt-trellis.aiff
 281252 tests/data/fate/acodec-adpcm-ima_qt-trellis.aiff
-593d68369c87d4e3b7323b1bea3e9315 *tests/data/fate/acodec-adpcm-ima_qt-trellis.out.wav
-stddev:  716.74 PSNR: 39.22 MAXDIFF:29633 bytes:  1058400/  1058560
+397d1fcfd141bed1a55721955791fb7f *tests/data/fate/acodec-adpcm-ima_qt-trellis.out.wav
+stddev:20006.83 PSNR: 10.31 MAXDIFF:65514 bytes:  1058400/   562360
Test acodec-adpcm-ima_qt-trellis failed. Look at tests/data/fate/acodec-adpcm-ima_qt-trellis.err for details.
make: *** [fate-acodec-adpcm-ima_qt-trellis] Error 1

[...]


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150104/ea26011e/attachment.asc>


More information about the ffmpeg-devel mailing list