[FFmpeg-devel] [PATCH] skip ##ix chunks reading as video/audio data

Michael Niedermayer michaelni
Sun Nov 23 20:12:25 CET 2008


On Sun, Nov 23, 2008 at 07:23:45PM +0200, Maksym Veremeyenko wrote:
> Michael Niedermayer ???????(??):
> [...]
> >> or 01ix :
> >>
> >> FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 30 
> >> 2146641244 805240575 100
> >> FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 30 31 2146641245 
> >> 825229055 100
> >> FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 30 31 69 2146641246 1764831231 
> >> 100
> >> FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 30 31 69 78 2146641247 2020159792 100
> >> FFFFFFFF FFFFFFFF FFFFFFFF 30 31 69 78 38 2146641248 947415345 100
> >> FFFFFFFF FFFFFFFF 30 31 69 78 38 FA 2146641249 -96962455 1
> >> FFFFFFFF 30 31 69 78 38 FA 1 2146641250 33175672 100
> >> 30 31 69 78 38 FA 1 0 2146641251 129592 100
> >>                                         ^^^
> > 
> > what are these numbers supposed to be?
> This is debug output log from avidec.c:
> [...]
>          n= get_stream_idx(d+2);
> //av_log(NULL, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d 
> %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
>          if(i + size > avi->fsize || d[0]<0)
>              continue;
> 
>          //parse ix##
>          if(  (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams)
>          //parse JUNK
>             ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
>             ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
>              url_fskip(pb, size);
> //av_log(NULL, AV_LOG_DEBUG, "SKIP\n");
>              goto resync;
> [...]
> 
> it suppose to output chunk fourcc, stream id (n)
> 
> > 
> > 
> >> Is this patch OK?
> > 
> > NO, this is just wrong you are removing the stream validity check thus
> > litterally breaking the demuxer.
> This done in same manner as idx1 skip done for example, does is wrong 
> to?....

no and no
the idx1 check, checks _4_ bytes, you remove a CORRECT check of 2 bytes
reducing the code to check just 2 bytes.
Besides you change the code intended to detect ix## while your chunks are
##ix this IS wrong.


> 
> In addition:
> 
> 1) the assign:
> [...]
>          n= get_stream_idx(d+2);
> [...]
> some years ago was:
> [...]
>          n= (d[2] - '0') * 10 + (d[3] - '0');
> [...]
> That seems good for ix00 or ix01, but not for 01xx or 00ix.
> 
> 2) if wrong stream detected by get_stream_idx it return 100, does it 
> have a reason to check:
> [...]
>          if(  (  (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams)
> [...]
> stream number for not to skip in a case of wrong stream?
> 
> I am not the author of original code, perhaps, am i missed something?

Yes, its something with error recovery, hint: if your check accepts
any random chunk the demuxer fails fatally once it becomes desyced


> What is preferable way to stop reading index block as frame data?

add a check for them, dont hack a random unrelated check to by luck
also trigger for them

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081123/57894f95/attachment.pgp>



More information about the ffmpeg-devel mailing list