[libbluray-devel] Skip empty file identifiers

Petri Hintukainen git at videolan.org
Sun Jun 25 12:59:21 CEST 2017


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Sun Jun 25 13:49:00 2017 +0300| [131629921cc756c38eaf3e2d6b69ba2db690b199] | committer: Petri Hintukainen

Skip empty file identifiers

Not strictly compilant (?), \0 is allowed in ECMA167 file identifier.

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

 src/udfread.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/udfread.c b/src/udfread.c
index 9313734..ba1b675 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -956,10 +956,21 @@ static int _parse_dir(const uint8_t *data, uint32_t length, struct udf_dir *dir)
         dir->files[dir->num_entries].icb = fid.icb;
         dir->files[dir->num_entries].filename = _cs0_to_utf8(fid.filename, fid.filename_len);
 
-        if (dir->files[dir->num_entries].filename) {
-            dir->num_entries++;
+        if (!dir->files[dir->num_entries].filename) {
+            continue;
+        }
+
+        /* Skip empty file identifiers.
+         * Not strictly compilant (?), \0 is allowed in
+         * ECMA167 file identifier.
+         */
+        if (!dir->files[dir->num_entries].filename[0]) {
+            udf_error("skipping empty file identifier\n");
+            free(dir->files[dir->num_entries].filename);
+            continue;
         }
 
+        dir->num_entries++;
     }
 
     return 0;



More information about the libbluray-devel mailing list