[vlc-commits] codec: opus: check comment size overflow

Francois Cartegnie git at videolan.org
Wed Dec 7 20:04:26 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec  7 19:45:38 2016 +0100| [d72019e145262567f0fc3168eeaa757c5e54f6ae] | committer: Francois Cartegnie

codec: opus: check comment size overflow

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d72019e145262567f0fc3168eeaa757c5e54f6ae
---

 modules/codec/opus_header.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/codec/opus_header.c b/modules/codec/opus_header.c
index 6d0ef49..ef6eec5 100644
--- a/modules/codec/opus_header.c
+++ b/modules/codec/opus_header.c
@@ -286,6 +286,9 @@ static int comment_pad(char **comments, size_t *length)
 {
     const unsigned padding = 512; /* default from opus-tools */
 
+    if(SIZE_MAX - *length < padding + 255)
+        return 1;
+
     char *p = *comments;
     /* Make sure there is at least "padding" worth of padding free, and
        round up to the maximum that fits in the current ogg segments. */



More information about the vlc-commits mailing list