[libbluray-devel] Use information length instead of file size when parsing inline directory files

Petri Hintukainen git at videolan.org
Fri Jun 9 12:33:43 CEST 2017


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Wed Jun  7 23:11:30 2017 +0300| [9303baa3c0878b84aa7fe32317f8453f8380c1d3] | committer: Petri Hintukainen

Use information length instead of file size when parsing inline directory files

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

 src/ecma167.c | 1 +
 src/ecma167.h | 1 +
 src/udfread.c | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ecma167.c b/src/ecma167.c
index 00c4a4d..142596f 100644
--- a/src/ecma167.c
+++ b/src/ecma167.c
@@ -306,6 +306,7 @@ static struct file_entry *_decode_file_entry(const uint8_t *p, size_t size,
         /* data of small files can be embedded in file entry */
         /* copy embedded file data */
         fe->content_inline = 1;
+        fe->u.data.information_length = l_ad;
         memcpy(fe->u.data.content, p + p_ad, l_ad);
     } else {
         fe->u.ads.num_ad = num_ad;
diff --git a/src/ecma167.h b/src/ecma167.h
index 38b73a2..227a3a1 100644
--- a/src/ecma167.h
+++ b/src/ecma167.h
@@ -223,6 +223,7 @@ struct file_entry {
 
         /* inline file */
         struct {
+            uint32_t       information_length; /* recorded information length, may be different than file length */
             uint8_t        content[1]; /* content of small files is embedded here */
         } data;
     } u;
diff --git a/src/udfread.c b/src/udfread.c
index a0f050b..67fec88 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -963,7 +963,7 @@ static struct udf_dir *_read_dir(udfread *udf, const struct long_ad *icb)
     if (fe->content_inline) {
         dir = (struct udf_dir *)calloc(1, sizeof(struct udf_dir));
         if (dir) {
-            if (_parse_dir(&fe->u.data.content[0], fe->length, dir) < 0) {
+            if (_parse_dir(&fe->u.data.content[0], fe->u.data.information_length, dir) < 0) {
                 udf_error("failed parsing inline directory file\n");
                 _free_dir(&dir);
             }



More information about the libbluray-devel mailing list