[FFmpeg-devel] [PATCH] asfdec: replace a assert by returning AVERROR_INVALIDDATA

Thierry Foucu tfoucu
Wed Oct 13 22:34:53 CEST 2010


Hi,

$subject

I have a file which goes through this path of code and assert.
Because of assert, we do not get anything from ffmpeg output:

$ffmpeg -i crash_asf_dec.asf
FFmpeg version SVN-r25471, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct 13 2010 13:00:02 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree
--enable-postproc
  libavutil     50.32. 3 / 50.32. 3
  libavcore      0. 9. 1 /  0. 9. 1
  libavcodec    52.92. 0 / 52.92. 0
  libavformat   52.82. 0 / 52.82. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.51. 1 /  1.51. 1
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[asf @ 0x23e6c70] packet_frag_size is invalid
[asf @ 0x23e6c70] ff asf bad header 2f  at:4327
[asf @ 0x23e6c70] ff asf skip 0 (unknown stream)
ffmpeg: libavformat/asfdec.c:856: ff_asf_parse_packet: Assertion `ret>=0'
failed.
Aborted


With this patch, I have now:
$ffmpeg -i crash_asf_dec.asf  /tmp/test.flv
FFmpeg version SVN-r25471, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct 13 2010 13:00:02 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree
--enable-postproc
  libavutil     50.32. 3 / 50.32. 3
  libavcore      0. 9. 1 /  0. 9. 1
  libavcodec    52.92. 0 / 52.92. 0
  libavformat   52.82. 0 / 52.82. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.51. 1 /  1.51. 1
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[asf @ 0x3130c70] PacketLeftSize:0  Pad:0 Pos:2846
[asf @ 0x3130c70] packet_frag_size is invalid
[asf @ 0x3130c70] PacketLeftSize:780  Pad:5 Pos:3522
[asf @ 0x3130c70] ff asf bad header 2f  at:4327
[asf @ 0x3130c70] ff asf skip 0 (unknown stream)

Seems stream 1 codec frame rate differs from container frame rate: 1000.00
(1000/1) -> 30.33 (91/3)
Input #0, asf, from 'crash_asf_dec.asf':
  Metadata:
    WMFSDKVersion   : 9.00.00.2980
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    PRIVATE/TotalBitrate: 241
    WM/VideoHeight  : 240
    WM/VideoWidth   : 320
    WM/VideoFrameRate: 299
    WM/EncodingTime : 3686945
    title           : My happy ending
    author          : Avril Lavigne
    copyright       : (c)
    comment         :
  Duration: 00:04:01.54, start: 3.000000, bitrate: 247 kb/s
    Stream #0.0: Audio: wmav2, 32000 Hz, 2 channels, s16, 32 kb/s
    Stream #0.1: Video: wmv2, yuv420p, 320x240, 209 kb/s, 30.33 tbr, 1k tbn,
1k tbc


-----------------------------------------------------------------------------------

Index: libavformat/asfdec.c
===================================================================
--- libavformat/asfdec.c (revision 25471)
+++ libavformat/asfdec.c (working copy)
@@ -853,7 +853,10 @@
             //asf->packet_size_left <= asf->packet_padsize) {
             int ret = asf->packet_size_left + asf->packet_padsize;
             //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n",
asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
-            assert(ret>=0);
+            //assert(ret>=0);
+            if (ret < 0) {
+              return AVERROR_INVALIDDATA;
+            }
             /* fail safe */
             url_fskip(pb, ret);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asfdec.patch
Type: text/x-patch
Size: 666 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101013/6f60dcf4/attachment.bin>



More information about the ffmpeg-devel mailing list