[FFmpeg-cvslog] flac_parser: speedup fifo realloc

Michael Niedermayer michaelni at gmx.at
Mon May 14 19:52:15 CEST 2012


On Mon, May 14, 2012 at 08:21:22AM +0200, Nicolas George wrote:
> Le sextidi 26 floréal, an CCXX, Michael Niedermayer a écrit :
> > -        if (av_fifo_realloc2(fpc->fifo_buf,
> > -                             (read_end - read_start) + av_fifo_size(fpc->fifo_buf)) < 0) {
> > +        if (   av_fifo_space(fpc->fifo_buf) < read_end - read_start
> > +            && av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) {
> 
> Isn't there a risk of integer overflow?
> 
> And as a side note, since reallocating exponentially is a common practice,
> it may be a builtin of av_fifo.

ill post a patch for this in a moment, using it will also fix integer
overflows

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20120514/3a8e3b9e/attachment.asc>


More information about the ffmpeg-cvslog mailing list