[vlc-commits] caf: fix integer underflow

Rémi Denis-Courmont git at videolan.org
Sun Dec 2 10:02:55 CET 2018


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec  1 23:32:18 2018 +0200| [f7b18385f6965cf96411da4d25792d893e979700] | committer: Jean-Baptiste Kempf

caf: fix integer underflow

Pointed-out-by: Hans Jerry Illikainen <hji at dyntopia.com>
(cherry picked from commit 0cc5ea748ee5ff7705dde61ab15dff8f58be39d0)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/caf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index b1a621f594..f1e6724c3c 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -691,14 +691,13 @@ static int ReadKukiChunk( demux_t *p_demux, uint64_t i_size )
     demux_sys_t *p_sys = p_demux->p_sys;
     const uint8_t *p_peek;
 
-    /* vlc_stream_Peek can't handle sizes bigger than INT32_MAX, and also p_sys->fmt.i_extra is of type 'int'*/
-    if( i_size > INT32_MAX )
+    if( i_size > SSIZE_MAX )
     {
         msg_Err( p_demux, "Magic Cookie chunk too big" );
         return VLC_EGENERIC;
     }
 
-    if( (unsigned int)vlc_stream_Peek( p_demux->s, &p_peek, (int)i_size ) < i_size )
+    if( vlc_stream_Peek( p_demux->s, &p_peek, i_size ) < (ssize_t)i_size )
     {
         msg_Err( p_demux, "Couldn't peek extra data" );
         return VLC_EGENERIC;



More information about the vlc-commits mailing list