From: Andre Noll Date: Sun, 29 May 2011 11:53:32 +0000 (+0200) Subject: ogg_get_file_info(): Fix off-by-one. X-Git-Tag: v0.4.7~2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=9f69f3dc96f72badd359d4ab7e65687871bc5876;ds=sidebyside ogg_get_file_info(): Fix off-by-one. The timing information encoded in the chunk table was not always sufficient to guarantee no buffer underruns since vorbis frames are frequently spread over two (or more) ogg pages. This should fix it. --- diff --git a/ogg_afh_common.c b/ogg_afh_common.c index cb59d363..564b0bec 100644 --- a/ogg_afh_common.c +++ b/ogg_afh_common.c @@ -170,7 +170,7 @@ int ogg_get_file_info(char *map, size_t numbytes, struct afh_info *afhi, for (j = 1; ogg_sync_pageseek(&oss, &op) > 0; /* nothing */) { int granule = ogg_page_granulepos(&op); - while (granule > j * frames_per_chunk) { + while (granule >= (j + 1) * frames_per_chunk) { j++; if (j >= ct_size) { ct_size *= 2;