[vorbis-dev] vorbisfile bug?

Vitaly Nechyos nvit at open.by
Wed Sep 25 15:08:54 PDT 2002

Good day.

It seems vorbisfile has a bug.

There is a such string in ov_time_seek:
ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate;

It is not accounted type convertion between double and ogg_int64_t.
E.g. if I convert 440267'th sample (44100Hz source) to time:
double dSec = 440267 / (double) 44100;
and then try to seek dSec:
ov_time_seek(pOVFile, dSec);
the resulting offset will be 440266'th sample, because of
dSec*44100 gives 440266.999999997...
Probably the line
ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate;
should be replaced with something like:
ogg_int64_t target=pcm_total+( (seconds-time_total)*vf->vi[link].rate +

It is very likely that this is not a unique place in source code with the
same problem.
(I use Visual C++ 6.0)


--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.

More information about the Vorbis-dev mailing list