# HG changeset patch # User nicodvb # Date 1162119302 0 # Node ID 5c953a55103ffda92cd93d279426c12a8f8ab7d7 # Parent 0cc36dd385ec81e31254953d25a96795e698a345 1000l: fixed broken handling of the adaption field - part 2 The value of c must be between 0 and 183 inclusive; is c is 0 I can't skip c-1 bytes! diff -r 0cc36dd385ec -r 5c953a55103f libmpdemux/demux_ts.c --- a/libmpdemux/demux_ts.c Sun Oct 29 10:33:49 2006 +0000 +++ b/libmpdemux/demux_ts.c Sun Oct 29 10:55:02 2006 +0000 @@ -2633,14 +2633,24 @@ int c; c = stream_read_char(stream); buf_size--; + if(c < 0 || c > 183) //broken from the stream layer or invalid + { + stream_skip(stream, buf_size-1+junk); + continue; + } + + //c==0 is allowed! + if(c > 0) + { rap_flag = (stream_read_char(stream) & 0x40) >> 6; buf_size--; - c = min(c-1, buf_size); + c--; stream_skip(stream, c); buf_size -= c; if(buf_size == 0) continue; + } } if(bad)