Prevent (negative) overflow of rm->remaining_len. This evaluation really only

has two possible outcomes: either len and rm->remaining_len are the same, in
which case we care about the outcome and it is zero, or rm->remaining_len is
currently not in use and we don't care about the outcome. In that case, len
is positive and rm->remaining_len is zero, which leads to a negative result.
This is confusing and could eventually lead to a sign-flip if we skip a lot
of packets (unlikely, but still). Therefore, just always set it to zero.

Originally committed as revision 17919 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ronald S. Bultje 2009-03-09 22:03:47 +00:00
parent 7ccefd08f6
commit b8cc5a9fdf
1 changed files with 1 additions and 1 deletions

View File

@ -468,7 +468,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
skip: skip:
/* skip packet if unknown number */ /* skip packet if unknown number */
url_fskip(pb, len); url_fskip(pb, len);
rm->remaining_len -= len; rm->remaining_len = 0;
continue; continue;
} }
*stream_index= i; *stream_index= i;