[vlc-commits] caf: fix error handling / integer overflow

2015-10-21 Thread Rémi Denis-Courmont
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont  | Fri Aug 
21 20:01:47 2015 +0300| [c6d45ea9e570f20c3aa16d72cf2423b463063124] | committer: 
Jean-Baptiste Kempf

caf: fix error handling / integer overflow

(cherry picked from commit de1b8bc4993780e2b92ee4b1e4ff27c9f3831dc6)
Signed-off-by: Jean-Baptiste Kempf 

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

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

diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index 465caf6..f5c63fc 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -277,7 +277,11 @@ static int FrameSpanAddDescription( demux_t *p_demux, 
uint64_t i_desc_offset, fr
 }
 
 const uint8_t *p_peek;
-uint32_t i_peek_len = stream_Peek( p_demux->s, _peek, 2 * 10 ); /* 
Peeking the maximum number of bytes that two 64 bit numbers could use (( 64 + 6 
) / 7 = 10 ). */
+int i_peek_len = stream_Peek( p_demux->s, _peek, 2 * 10 );
+/* Peeking the maximum number of bytes that two 64 bit numbers could use
+ * (( 64 + 6 ) / 7 = 10). */
+if( i_peek_len < 0 )
+i_peek_len = 0;
 
 if( p_sys->fmt.audio.i_bytes_per_frame )
 {
@@ -302,7 +306,7 @@ static int FrameSpanAddDescription( demux_t *p_demux, 
uint64_t i_desc_offset, fr
 }
 else
 {
-if( i_desc_size >= i_peek_len )
+if( i_desc_size >= (unsigned)i_peek_len )
 {
 return VLC_EGENERIC;
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] caf: fix error handling / integer overflow

2015-08-21 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Fri Aug 21 
20:01:47 2015 +0300| [de1b8bc4993780e2b92ee4b1e4ff27c9f3831dc6] | committer: 
Rémi Denis-Courmont

caf: fix error handling / integer overflow

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

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

diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index 465caf6..f5c63fc 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -277,7 +277,11 @@ static int FrameSpanAddDescription( demux_t *p_demux, 
uint64_t i_desc_offset, fr
 }
 
 const uint8_t *p_peek;
-uint32_t i_peek_len = stream_Peek( p_demux-s, p_peek, 2 * 10 ); /* 
Peeking the maximum number of bytes that two 64 bit numbers could use (( 64 + 6 
) / 7 = 10 ). */
+int i_peek_len = stream_Peek( p_demux-s, p_peek, 2 * 10 );
+/* Peeking the maximum number of bytes that two 64 bit numbers could use
+ * (( 64 + 6 ) / 7 = 10). */
+if( i_peek_len  0 )
+i_peek_len = 0;
 
 if( p_sys-fmt.audio.i_bytes_per_frame )
 {
@@ -302,7 +306,7 @@ static int FrameSpanAddDescription( demux_t *p_demux, 
uint64_t i_desc_offset, fr
 }
 else
 {
-if( i_desc_size = i_peek_len )
+if( i_desc_size = (unsigned)i_peek_len )
 {
 return VLC_EGENERIC;
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits