[libdvdnav-devel] [PATCH] DVDReadBytes(): Check that requested size fits in ssize_t

Petri Hintukainen phintuka at gmail.com
Wed Sep 9 09:12:29 CEST 2015


---
 src/dvd_reader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dvd_reader.c b/src/dvd_reader.c
index 0ac25b3..9c77dbd 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -1363,7 +1363,7 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size )
   int ret;
 
   /* Check arguments. */
-  if( dvd_file == NULL || data == NULL )
+  if( dvd_file == NULL || data == NULL || (ssize_t)byte_size < 0 )
     return -1;
 
   seek_sector = dvd_file->seek_pos / DVD_VIDEO_LB_LEN;
-- 
2.1.4



More information about the libdvdnav-devel mailing list