[FFmpeg-cvslog] samplefmt: avoid integer overflow in av_samples_get_buffer_size()

Justin Ruggles git at videolan.org
Mon Mar 10 18:47:18 CET 2014


ffmpeg | branch: release/0.10 | Justin Ruggles <justin.ruggles at gmail.com> | Thu Jan 30 14:08:38 2014 -0500| [9786c24bb756775796ff1fc240f700dafc39d222] | committer: Reinhard Tartler

samplefmt: avoid integer overflow in av_samples_get_buffer_size()

CC:libav-stable at libav.org
(cherry picked from commit 0e830094ad0dc251613a0aa3234d9c5c397e02e6)
(cherry picked from commit e9b3abd49890e958c745ea46a9f4f91b6b4baa58)

Conflicts:
	libavutil/samplefmt.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9786c24bb756775796ff1fc240f700dafc39d222
---

 libavutil/samplefmt.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index 8d6125b..a3e898c 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -105,8 +105,11 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
         return AVERROR(EINVAL);
 
     /* auto-select alignment if not specified */
-    if (!align)
+    if (!align) {
+        if (nb_samples > INT_MAX - 31)
+            return AVERROR(EINVAL);
         align = 32;
+    }
 
     /* check for integer overflow */
     if (nb_channels > INT_MAX / align ||



More information about the ffmpeg-cvslog mailing list