samplefmt: avoid integer overflow in av_samples_get_buffer_size()
authorJustin Ruggles <justin.ruggles@gmail.com>
Thu, 30 Jan 2014 19:08:38 +0000 (14:08 -0500)
committerJustin Ruggles <justin.ruggles@gmail.com>
Tue, 4 Feb 2014 17:32:47 +0000 (12:32 -0500)
CC:libav-stable@libav.org

libavutil/samplefmt.c

index 389f726..bff6004 100644 (file)
@@ -118,6 +118,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
 
     /* auto-select alignment if not specified */
     if (!align) {
+        if (nb_samples > INT_MAX - 31)
+            return AVERROR(EINVAL);
         align = 1;
         nb_samples = FFALIGN(nb_samples, 32);
     }