aboutsummaryrefslogtreecommitdiff
path: root/squashfs-tools/unsquashfs.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@squashfs.org.uk>2013-02-01 01:04:19 +0000
committerPhillip Lougher <phillip@squashfs.org.uk>2013-02-01 01:04:19 +0000
commite6fd6e125e7d63b871b8320b21b52c96b10063a9 (patch)
tree86f55e17a5df73577b20cb22f362230c4f6980ca /squashfs-tools/unsquashfs.c
parentafa08aa64225405c63145e144e04bdf473e32d1b (diff)
downloadsquashfs-tools-e6fd6e125e7d63b871b8320b21b52c96b10063a9.tar.gz
unsquashfs: fix read_directory_table() parameter
sBlk.s.fragment_table_start isn't the end of the directory table, it instead points to the fragment_index_table, in which the first index of that points to the end of the directory table. The only exception to that is where fragments == 0, where fragment_table_start does represent the end of the directory table. The upshot of this is that for years Unsquashfs has been reading and decompressing the directory_table and the table after it. Not a major bug, but a waste of memory all the same. It has shown up now because of the additional sanity checks when reading metadata blocks that have been added recently, where all metadata blocks in the directory table bar the last one should be SQUASHFS_METADATA_SIZE in size. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Diffstat (limited to 'squashfs-tools/unsquashfs.c')
-rw-r--r--squashfs-tools/unsquashfs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
index 5b8fd43..a9441a8 100644
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -2340,7 +2340,7 @@ int parse_number(char *arg, int *res)
#define VERSION() \
- printf("unsquashfs version 4.2-git (2013/01/27)\n");\
+ printf("unsquashfs version 4.2-git (2013/01/31)\n");\
printf("copyright (C) 2013 Phillip Lougher "\
"<phillip@squashfs.org.uk>\n\n");\
printf("This program is free software; you can redistribute it and/or"\
@@ -2364,6 +2364,7 @@ int main(int argc, char *argv[])
int n;
struct pathnames *paths = NULL;
struct pathname *path = NULL;
+ long long directory_table_end;
int fragment_buffer_size = FRAGMENT_BUFFER_DEFAULT;
int data_buffer_size = DATA_BUFFER_DEFAULT;
@@ -2622,7 +2623,7 @@ options:
if(s_ops.read_uids_guids() == FALSE)
EXIT_UNSQUASH("failed to uid/gid table\n");
- if(s_ops.read_fragment_table() == FALSE)
+ if(s_ops.read_fragment_table(&directory_table_end) == FALSE)
EXIT_UNSQUASH("failed to read fragment table\n");
if(read_inode_table(sBlk.s.inode_table_start,
@@ -2630,7 +2631,7 @@ options:
EXIT_UNSQUASH("failed to read inode table\n");
if(read_directory_table(sBlk.s.directory_table_start,
- sBlk.s.fragment_table_start) == FALSE)
+ directory_table_end) == FALSE)
EXIT_UNSQUASH("failed to read directory table\n");
if(no_xattrs)