comparison rmdec.c @ 4692:71f1392ab8d4 libavformat

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.
author rbultje
date Mon, 09 Mar 2009 22:03:47 +0000
parents eb3f12a921ab
children 4de640349078
comparison
equal deleted inserted replaced
4691:eb3f12a921ab 4692:71f1392ab8d4
466 } 466 }
467 if (i == s->nb_streams) { 467 if (i == s->nb_streams) {
468 skip: 468 skip:
469 /* skip packet if unknown number */ 469 /* skip packet if unknown number */
470 url_fskip(pb, len); 470 url_fskip(pb, len);
471 rm->remaining_len -= len; 471 rm->remaining_len = 0;
472 continue; 472 continue;
473 } 473 }
474 *stream_index= i; 474 *stream_index= i;
475 475
476 return len; 476 return len;