[libbluray-devel] udfread_file_read(): check for past-eof file pointer

Petri Hintukainen git at videolan.org
Sat Jun 24 14:41:10 CEST 2017


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Fri Jun 23 15:34:26 2017 +0300| [eabfca9523b3e60c8e769d0915b123141e12d583] | committer: Petri Hintukainen

udfread_file_read(): check for past-eof file pointer

> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=eabfca9523b3e60c8e769d0915b123141e12d583
---

 src/udfread.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/udfread.c b/src/udfread.c
index 999e140..0cfdac2 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -1588,6 +1588,10 @@ ssize_t udfread_file_read(UDFFILE *p, void *buf, size_t bytes)
         return -1;
     }
 
+    if (p->pos >= udfread_file_size(p)) {
+        return 0;
+    }
+
     /* limit range to file size */
     if ((uint64_t)p->pos + bytes > (uint64_t)udfread_file_size(p)) {
         bytes = udfread_file_size(p) - p->pos;



More information about the libbluray-devel mailing list