[FFmpeg-devel] [PATCH] fix ffmpeg crash on reading "non-interleved" DV type 1 AVI files

Maksym Veremeyenko verem
Sat Jan 16 13:37:06 CET 2010


Michael Niedermayer ???????(??):
> On Fri, Jan 15, 2010 at 12:05:13PM +0200, Maksym Veremeyenko wrote:
>> Michael Niedermayer ???????(??):
[...]
>>  171:             if(last_pos == pos || pos == base - 8)
>>  172:                 avi->non_interleaved= 1;
>>                       ^^^^^^^^^^^^^^^^^^^^^^^^
> 
> hmm
> is commenting out the pos == base - 8 fixing it?
no. i did some logging inserted:

--- libavformat/avidec.c	(revision 21242)
+++ libavformat/avidec.c	(working copy)
@@ -168,7 +168,9 @@
              if(url_feof(pb))
                  return -1;

-            if(last_pos == pos || pos == base - 8)
+if(pos == base - 8) av_log(s, AV_LOG_ERROR, "[read_braindead_odml_indx] 
pos == base - 8\n, pos:%"PRId64", base:%"PRId64"\n",
pos, base);
+if(last_pos == pos) av_log(s, AV_LOG_ERROR, "[read_braindead_odml_indx] 
last_pos == pos\n, pos:%"PRId64", base:%"PRId64"\n",
pos, base);
+            if(last_pos == pos /* || pos == base - 8 */)
                  avi->non_interleaved= 1;
              if(last_pos != pos && (len || !ast->sample_size))
                  av_add_index_entry(st, pos, ast->cum_len, len, 0, key 
? AVINDEX_KEYFRAME : 0);

so the output still segfault:

[root at diva-proxy ffmpeg-r21242]# ./ffmpeg_g -i 
"/home/lowres/lost+found/Amer001.AVI" -vcodec copy -acodec copy -y 
/tmp/test.dv
FFmpeg version SVN-r21242, Copyright (c) 2000-2010 Fabrice Bellard, et al.
   built on Jan 16 2010 13:43:20 with gcc 4.3.2 20081105 (Red Hat 4.3.2-7)
   configuration: --prefix=/home/enctools --enable-libfaac 
--enable-libfaad --enable-libmp3lame --enable-postproc --enable-pthreads 
--enable-libx264 --enable-libxvid 
--extra-cflags='-I/home/enctools/include -DDEBUG' 
--extra-ldflags=-L/home/enctools/lib --enable-shared --enable-gpl 
--enable-nonfree --enable-avfilter --enable-avfilter-lavf --enable-debug=3
   libavutil     50. 7. 0 / 50. 7. 0
   libavcodec    52.48. 0 / 52.48. 0
   libavformat   52.47. 0 / 52.47. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter    1.17. 0 /  1.17. 0
   libswscale     0. 8. 0 /  0. 8. 0
   libpostproc   51. 2. 0 / 51. 2. 0
[avi @ 0x9072390][read_braindead_odml_indx] pos == base - 8
, pos:12214020600, base:12214020608
     Last message repeated 1 times
[avi @ 0x9072390][read_braindead_odml_indx] last_pos == pos
, pos:12214020600, base:12214020608
[avi @ 0x9072390][read_braindead_odml_indx] pos == base - 8
, pos:12214020600, base:12214020608
[avi @ 0x9072390][read_braindead_odml_indx] last_pos == pos
, pos:12214020600, base:12214020608
[avi @ 0x9072390]non-interleaved AVI
[avi @ 0x9072390]Estimating duration from bitrate, this may be inaccurate
Input #0, avi, from '/home/lowres/lost+found/Amer001.AVI':
   Duration: 01:26:51.16, start: 0.000000, bitrate: 30336 kb/s
     Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 
59:54 DAR 295:216, 25 tbr, 25 tbn, 25 tbc
     Stream #0.1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, dv, to '/tmp/test.dv':
     Stream #0.0: Video: dvvideo, yuv420p, 720x576 [PAR 59:54 DAR 
295:216], q=2-31, 28800 kb/s, 90k tbn, 25 tbc
     Stream #0.1: Audio: pcm_s16le, 48000 Hz, 2 channels, 1536 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
Press [q] to stop encoding
Segmentation fault
[root at diva-proxy ffmpeg-r21242]#

i dig into svn log history for "if(last_pos == pos || pos == base - 8)" 
and that one string was introduced in r5088.

> 
> also what is the output of ffmpeg -v 9 -loglevel 99 -i yourfile.avi

[root at diva-proxy ffmpeg-r21242]# ./ffmpeg_g -v 9 -loglevel 99  -i 
"/home/lowres/lost+found/Amer001.AVI" -vcodec copy -acodec copy -y 
/tmp/test.dv
FFmpeg version SVN-r21242, Copyright (c) 2000-2010 Fabrice Bellard, et al.
   built on Jan 16 2010 13:43:20 with gcc 4.3.2 20081105 (Red Hat 4.3.2-7)
   configuration: --prefix=/home/enctools --enable-libfaac 
--enable-libfaad --enable-libmp3lame --enable-postproc --enable-pthreads 
--enable-libx264 --enable-libxvid 
--extra-cflags='-I/home/enctools/include -DDEBUG' 
--extra-ldflags=-L/home/enctools/lib --enable-shared --enable-gpl 
--enable-nonfree --enable-avfilter --enable-avfilter-lavf --enable-debug=3
   libavutil     50. 7. 0 / 50. 7. 0
   libavcodec    52.48. 0 / 52.48. 0
   libavformat   52.47. 0 / 52.47. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter    1.17. 0 /  1.17. 0
   libswscale     0. 8. 0 /  0. 8. 0
   libpostproc   51. 2. 0 / 51. 2. 0
layer1, 44100 Hz, 64000 kbits/s, mono
[NULL @ 0x8652390]Probed with size=2048 and score=100
tag: tag=LIST size=0x7fc4
list: tag=hdrl size=0x0
tag: tag=avih size=0x38
tag: tag=LIST size=0x7e6c
list: tag=strl size=0x0
tag: tag=strh size=0x38
strh: tag=iavs size=0xffffffff
tag: tag=strf size=0x20
tag: tag=indx size=0x7df8
tag: tag=LIST size=0x104
list: tag=odml size=0x0
tag: tag=dmlh size=0xf8
tag: tag=JUNK size=0x14
tag: tag=LIST size=0x3fbf8804
list: tag=movi size=0x0
movi end=3fc00800
[avi @ 0x8652390]non-interleaved AVI
[avi @ 0x8652390]All info found
[avi @ 0x8652390]Estimating duration from bitrate, this may be inaccurate
Input #0, avi, from '/home/lowres/lost+found/Amer001.AVI':
   Duration: 01:26:51.16, start: 0.000000, bitrate: 30336 kb/s
     Stream #0.0, 1/25: Video: dvvideo, yuv420p, 720x576, 1/25, 28800 
kb/s, PAR 59:54 DAR 295:216, 25 tbr, 25 tbn, 25 tbc
     Stream #0.1, 1/30000: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 
1536 kb/s
Output #0, dv, to '/tmp/test.dv':
     Stream #0.0, 1/90000: Video: dvvideo, yuv420p, 720x576 [PAR 59:54 
DAR 295:216], 1/25, q=2-31, 28800 kb/s, 90k tbn, 25 tbc
     Stream #0.1, 1/90000: Audio: pcm_s16le, 48000 Hz, 2 channels, 1536 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
Press [q] to stop encoding
Segmentation fault
[root at diva-proxy ffmpeg-r21242]#

-- 
________________________________________
Maksym Veremeyenko




More information about the ffmpeg-devel mailing list