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

Petri Hintukainen git at videolan.org
Wed Sep 9 09:50:05 CEST 2015


libdvdread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Wed Sep  9 10:12:29 2015 +0300| [752bbae6bc7b517f9819d182a2e3ddca44b112d8] | committer: Jean-Baptiste Kempf

DVDReadBytes(): Check that requested size fits in ssize_t

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=752bbae6bc7b517f9819d182a2e3ddca44b112d8
---

 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 34d1a50..18b5f12 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -1354,7 +1354,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;



More information about the libdvdnav-devel mailing list