On 2018-02-15 10:17, Philipp M. Scholl wrote:
On Wed, Feb 14, 2018 at 03:41:18PM +0100, Tomas Härdin wrote:
[..snip..]
FFMAX(codec->sample_rate/25, 1) would be nicer

agree.

+    size = FFMIN(size, RAW_SAMPLES * codec->block_align);
+    size = 1 << ff_log2(size);
-    size= RAW_SAMPLES*s->streams[0]->codecpar->block_align;
       if (size <= 0)
           return AVERROR(EINVAL);
This will never be true since ff_log() always returns >= 0 which makes size
= 1. I suggest putting it before the 1 << ff_log2.
  This can only happen when block_align == 0. So, a check à la

   if (codec->block_align <= 0)
     return AVERROR(EINVAL);

  before calculating the size, should suffice?

That should catch all of them yes. I wish we could prove things like this in C like in Ada/SPARK. Alas..

/Tomas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to