[Vorbis-dev] buffer overruns for small files

Steve Russell srussell at innernet.net
Mon Nov 7 17:46:15 PST 2005


dwBufferLength is the allocated length.

  long bytes_read = ov_read(&vf, m_lpDataVorbis + dwBufferLength, 4096, 0, 
2, 1, &current_section);
  if(bytes_read == 0)
  {
   // EOF
   eof = 1;
  }
  else
   dwBufferLength += bytes_read;

As to trying example decoders, every time I try to compile something for a 
test, I run into at least one mysterious hangup.  I guess it's related to 
Windows; maybe I simply lack some very pertinent knowledge.  Same for Speex. 
In regard to vorbis_synthesis, where exactly would I place a TRACE?  in what 
file?
----- Original Message ----- 
From: "Ian Malone" <ibm21 at cam.ac.uk>
To: <vorbis-dev at xiph.org>
Sent: Sunday, November 06, 2005 8:34 AM
Subject: Re: [Vorbis-dev] buffer overruns for small files


> Not a clue, but since this hasn't been picked up:
> How do the reference and example decoders handle these files?
> Is dwBufferLength the allocated length or the attempted write
> length?  Can you trace into vorbis_synthesis and see how
> much is being allocated?
>
> imalone
>
>
> Steve Russell wrote:
>> I wonder if anyone would have a comment on an experiment I have pretty 
>> much completed in my MFC/C++ project.  With my simple libvorbis 
>> implementation, ogg decoding works just fine for files that are 10kb or 
>> larger.  For anything smaller (actually, I don't have a 9kb file, so <= 
>> 8), it seems that I get an inaccurate value for ov_pcm_total.  Though 
>> ov_read returns zero, I overflow the buffer and crash on ov_clear.  These 
>> are my TRACE statements:
>>
>>
>>>= 10kb:
>>
>>
>> Opening Audio File 'no_0.ogg'
>> vi->channels = '2'
>> vi->rate = '44100'
>> pcmTotal = '15341'
>> pcmTotal * vi->channels * 2 = '61364'
>> BufferSize = '61364'
>> dwBufferLength = '61364'
>> BufferSize = '61364'
>> dwBufferLength - BufferSize = '0'
>> ------------
>> < 10kb:
>>
>> Opening Audio File 'Steel guitar_4.ogg'
>> vi->channels = '2'
>> vi->rate = '44100'
>> pcmTotal = '9876'
>> pcmTotal * vi->channels * 2 = '39504'
>> BufferSize = '39504'
>> dwBufferLength = '43264'
>> BufferSize = '39504'
>> dwBufferLength - BufferSize = '3760'
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Vorbis-dev mailing list
>> Vorbis-dev at xiph.org
>> http://lists.xiph.org/mailman/listinfo/vorbis-dev
>
> _______________________________________________
> Vorbis-dev mailing list
> Vorbis-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/vorbis-dev 



More information about the Vorbis-dev mailing list