[vlc-commits] nsv: fix boundary check, signedness warning
Rémi Denis-Courmont
git at videolan.org
Sat Jul 13 11:53:22 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jul 13 11:57:42 2019 +0300| [3615b4217d71628972d5eb96a9a9f77b6f57fa2b] | committer: Rémi Denis-Courmont
nsv: fix boundary check, signedness warning
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3615b4217d71628972d5eb96a9a9f77b6f57fa2b
---
modules/demux/nsv.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index eef57b26a7..8e6374048c 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -28,6 +28,8 @@
# include "config.h"
#endif
+#include <limits.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
@@ -484,10 +486,14 @@ static int ReadNSVf( demux_t *p_demux )
if( i_header_size == 0 || i_header_size == UINT32_MAX )
return VLC_EGENERIC;
-
-
- return vlc_stream_Read( p_demux->s, NULL, i_header_size ) == i_header_size
- ? VLC_SUCCESS : VLC_EGENERIC;
+#if (UINT32_MAX > SSIZE_MAX)
+ if( i_header_size > SSIZE_MAX )
+ return VLC_EGENERIC;
+#endif
+ if ( vlc_stream_Read( p_demux->s, NULL, i_header_size )
+ < (ssize_t)i_header_size )
+ return VLC_EGENERIC;
+ return VLC_SUCCESS;
}
/*****************************************************************************
* ReadNSVs:
More information about the vlc-commits
mailing list