From 2af0b9d303902c9ad7ba20955d9441981df4e535 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Tue, 14 Apr 2020 11:41:14 +0300 Subject: [PATCH] squashfs-tools: bump to version 4.4 All patches are not needed anymore. squashfs-tools has implemented them in one way or another. Converted to download release tarballs. This should work better to get notified of a newer release. Also adds support for ZSTD compression: https://facebook.github.io/zstd/ Signed-off-by: Alexandru Ardelean --- utils/squashfs-tools/Config.in | 6 + utils/squashfs-tools/Makefile | 27 +- ...c-get-inline-functions-work-with-C99.patch | 154 ------ .../patches/0004-vla-to-malloc.patch | 474 ------------------ ...ashfs-fix-compilation-with-glibc-2.2.patch | 47 -- 5 files changed, 21 insertions(+), 687 deletions(-) delete mode 100644 utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch delete mode 100644 utils/squashfs-tools/patches/0004-vla-to-malloc.patch delete mode 100644 utils/squashfs-tools/patches/0005-mksquashfs-unsquashfs-fix-compilation-with-glibc-2.2.patch diff --git a/utils/squashfs-tools/Config.in b/utils/squashfs-tools/Config.in index eae3ae184..6d556700f 100644 --- a/utils/squashfs-tools/Config.in +++ b/utils/squashfs-tools/Config.in @@ -15,3 +15,9 @@ config SQUASHFS_TOOLS_XZ_SUPPORT bool "Enable XZ support" select PACKAGE_liblzma default n + +config SQUASHFS_TOOLS_ZSTD_SUPPORT + depends on PACKAGE_squashfs-tools-mksquashfs || PACKAGE_squashfs-tools-unsquashfs + bool "Enable ZSTD support" + select PACKAGE_libzstd + default n diff --git a/utils/squashfs-tools/Makefile b/utils/squashfs-tools/Makefile index d9ef50e37..09e6e8225 100644 --- a/utils/squashfs-tools/Makefile +++ b/utils/squashfs-tools/Makefile @@ -8,18 +8,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=squashfs-tools -PKG_VERSION:=4.3 -PKG_RELEASE:=6 -PKG_LICENSE:=GPL-2.0 +PKG_VERSION:=4.4 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Alexandru Ardelean PKG_CPE_ID:=cpe:/a:phillip_lougher:squashfs -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/plougher/squashfs-tools -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=5be5d61e5e5a93911256b5f2106e50da0ca81e8d -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz -PKG_MIRROR_HASH:=eac1bc559708dc8656fe7d099ffc9e9374ae0cfb9a12d180a9c0c28acb0adf11 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/plougher/squashfs-tools/tar.gz/${PKG_VERSION}? +PKG_HASH:=a7fa4845e9908523c38d4acf92f8a41fdfcd19def41bd5090d7ad767a6dc75c3 PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk @@ -28,13 +27,13 @@ define Package/squashfs-tools/Default SECTION:=utils CATEGORY:=Utilities SUBMENU:=Filesystem - TITLE:=squashfs-tools + TITLE:=Tools to create and extract Squashfs filesystems URL:=https://github.com/plougher/squashfs-tools DEPENDS += +libpthread +zlib \ +SQUASHFS_TOOLS_LZO_SUPPORT:liblzo \ +SQUASHFS_TOOLS_LZ4_SUPPORT:liblz4 \ - +SQUASHFS_TOOLS_XZ_SUPPORT:liblzma - MAINTAINER:=Alexandru Ardelean + +SQUASHFS_TOOLS_XZ_SUPPORT:liblzma \ + +SQUASHFS_TOOLS_ZSTD_SUPPORT:libzstd endef define Package/squashfs-tools-mksquashfs @@ -68,6 +67,10 @@ ifneq ($(CONFIG_SQUASHFS_TOOLS_LZ4_SUPPORT),) MAKE_FLAGS += LZ4_SUPPORT=1 endif +ifneq ($(CONFIG_SQUASHFS_TOOLS_ZSTD_SUPPORT),) +MAKE_FLAGS += ZSTD_SUPPORT=1 +endif + define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR)/squashfs-tools \ CC="$(TARGET_CC)" \ diff --git a/utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch b/utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch deleted file mode 100644 index a5bab0544..000000000 --- a/utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch +++ /dev/null @@ -1,154 +0,0 @@ -From ac6268e843c43286eebff2a1052182c2393cdb2e Mon Sep 17 00:00:00 2001 -From: Roy Li -Date: Mon, 14 Sep 2015 12:31:42 +0800 -Subject: [PATCH] mksquashfs.c: get inline functions work with both gnu11 and gnu89 - -Upstream-Status: Pending - -After gcc upgraded to gcc5, and if the codes is compiled without optimization(-O0), -and the below error will happen: - -| mksquashfs.o: In function `create_inode': -| git/squashfs-tools/mksquashfs.c:897: undefined reference to `get_inode_no' -| git/squashfs-tools/mksquashfs.c:960: undefined reference to `get_parent_no' -| git/squashfs-tools/mksquashfs.c:983: undefined reference to `get_parent_no' -| mksquashfs.o: In function `reader_read_process': -| git/squashfs-tools/mksquashfs.c:2132: undefined reference to `is_fragment' -| mksquashfs.o: In function `reader_read_file': -| git/squashfs-tools/mksquashfs.c:2228: undefined reference to `is_fragment' -| mksquashfs.o: In function `dir_scan': -| git/squashfs-tools/mksquashfs.c:3101: undefined reference to `create_dir_entry' - -gcc5 defaults to -std=gnu11 instead of -std=gnu89, and it requires that exactly one C -source file has the callable copy of the inline function. Consider the following -program: - - inline int - foo (void) - { - return 42; - } - - int - main (void) - { - return foo (); - } - -The program above will not link with the C99 inline semantics, because no out-of-line -function foo is generated. To fix this, either mark the function foo as static, or -add the following declaration: - static inline int foo (void); - -more information refer to: https://gcc.gnu.org/gcc-5/porting_to.html; - -but the use of "extern inline" will lead to the compilation issue if gcc is not -gcc5, as the commit in oe-core d0af30c92fde [alsa-lib: Change function type to -"static __inline__"] - "extern __inline__ function()" is the inlined version that - can be used in this compilation unit, but there will be another - definition of this function somewhere, so compiler will not emit - any code for the function body. This causes problem in -O0, - where functions are never inlined, the function call is preserved, - but linker can't find the symbol, thus the error happens. - -so replace "inline" with "static inline" to make it work with both gnu11 and gnu89 - -Signed-off-by: Roy Li ---- - squashfs-tools/mksquashfs.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c -index d221c35..6bba1d2 100644 ---- a/squashfs-tools/mksquashfs.c -+++ b/squashfs-tools/mksquashfs.c -@@ -828,13 +828,13 @@ char *subpathname(struct dir_ent *dir_ent) - } - - --inline unsigned int get_inode_no(struct inode_info *inode) -+static inline unsigned int get_inode_no(struct inode_info *inode) - { - return inode->inode_number; - } - - --inline unsigned int get_parent_no(struct dir_info *dir) -+static inline unsigned int get_parent_no(struct dir_info *dir) - { - return dir->depth ? get_inode_no(dir->dir_ent->inode) : inode_no; - } -@@ -2027,7 +2027,7 @@ struct file_info *duplicate(long long file_size, long long bytes, - } - - --inline int is_fragment(struct inode_info *inode) -+static inline int is_fragment(struct inode_info *inode) - { - off_t file_size = inode->buf.st_size; - -@@ -2996,13 +2996,13 @@ struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id) - } - - --inline struct inode_info *lookup_inode(struct stat *buf) -+static inline struct inode_info *lookup_inode(struct stat *buf) - { - return lookup_inode2(buf, 0, 0); - } - - --inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this) -+static inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this) - { - if (inode->inode_number == 0) { - inode->inode_number = use_this ? : inode_no ++; -@@ -3013,7 +3013,7 @@ inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this) - } - - --inline struct dir_ent *create_dir_entry(char *name, char *source_name, -+static inline struct dir_ent *create_dir_entry(char *name, char *source_name, - char *nonstandard_pathname, struct dir_info *dir) - { - struct dir_ent *dir_ent = malloc(sizeof(struct dir_ent)); -@@ -3031,7 +3031,7 @@ inline struct dir_ent *create_dir_entry(char *name, char *source_name, - } - - --inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir, -+static inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir, - struct inode_info *inode_info) - { - struct dir_info *dir = dir_ent->our_dir; -@@ -3047,7 +3047,7 @@ inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir, - } - - --inline void add_dir_entry2(char *name, char *source_name, -+static inline void add_dir_entry2(char *name, char *source_name, - char *nonstandard_pathname, struct dir_info *sub_dir, - struct inode_info *inode_info, struct dir_info *dir) - { -@@ -3059,7 +3059,7 @@ inline void add_dir_entry2(char *name, char *source_name, - } - - --inline void free_dir_entry(struct dir_ent *dir_ent) -+static inline void free_dir_entry(struct dir_ent *dir_ent) - { - if(dir_ent->name) - free(dir_ent->name); -@@ -3080,7 +3080,7 @@ inline void free_dir_entry(struct dir_ent *dir_ent) - } - - --inline void add_excluded(struct dir_info *dir) -+static inline void add_excluded(struct dir_info *dir) - { - dir->excluded ++; - } --- -1.9.1 - diff --git a/utils/squashfs-tools/patches/0004-vla-to-malloc.patch b/utils/squashfs-tools/patches/0004-vla-to-malloc.patch deleted file mode 100644 index ffe2a79ec..000000000 --- a/utils/squashfs-tools/patches/0004-vla-to-malloc.patch +++ /dev/null @@ -1,474 +0,0 @@ -diff -aurp a/squashfs-tools/unsquash-1.c b/squashfs-tools/unsquash-1.c ---- a/squashfs-tools/unsquash-1.c 2014-09-18 20:16:18.000000000 -0600 -+++ b/squashfs-tools/unsquash-1.c 2017-08-29 13:18:14.403020644 -0600 -@@ -332,17 +332,19 @@ int read_uids_guids_1() - guid_table = uid_table + sBlk.no_uids; - - if(swap) { -- unsigned int suid_table[sBlk.no_uids + sBlk.no_guids]; -+ unsigned int* suid_table = malloc((sBlk.no_uids + sBlk.no_guids) * sizeof(unsigned int)); - - res = read_fs_bytes(fd, sBlk.uid_start, (sBlk.no_uids + - sBlk.no_guids) * sizeof(unsigned int), suid_table); - if(res == FALSE) { -+ free(suid_table); - ERROR("read_uids_guids: failed to read uid/gid table" - "\n"); - return FALSE; - } - SQUASHFS_SWAP_INTS_3(uid_table, suid_table, - sBlk.no_uids + sBlk.no_guids); -+ free(suid_table); - } else { - res = read_fs_bytes(fd, sBlk.uid_start, (sBlk.no_uids + - sBlk.no_guids) * sizeof(unsigned int), uid_table); -diff -aurp a/squashfs-tools/unsquash-2.c b/squashfs-tools/unsquash-2.c ---- a/squashfs-tools/unsquash-2.c 2014-09-18 20:16:18.000000000 -0600 -+++ b/squashfs-tools/unsquash-2.c 2017-08-29 13:23:48.111321548 -0600 -@@ -32,7 +32,7 @@ void read_block_list_2(unsigned int *blo - TRACE("read_block_list: blocks %d\n", blocks); - - if(swap) { -- unsigned int sblock_list[blocks]; -+ unsigned int* sblock_list = malloc(blocks*sizeof(unsigned int)); - memcpy(sblock_list, block_ptr, blocks * sizeof(unsigned int)); - SQUASHFS_SWAP_INTS_3(block_list, sblock_list, blocks); - } else -@@ -45,7 +45,7 @@ int read_fragment_table_2(long long *dir - int res, i; - int bytes = SQUASHFS_FRAGMENT_BYTES_2(sBlk.s.fragments); - int indexes = SQUASHFS_FRAGMENT_INDEXES_2(sBlk.s.fragments); -- unsigned int fragment_table_index[indexes]; -+ unsigned int* fragment_table_index = malloc(indexes * sizeof(unsigned int)); - - TRACE("read_fragment_table: %d fragments, reading %d fragment indexes " - "from 0x%llx\n", sBlk.s.fragments, indexes, -@@ -53,6 +53,7 @@ int read_fragment_table_2(long long *dir - - if(sBlk.s.fragments == 0) { - *directory_table_end = sBlk.s.fragment_table_start; -+ free(fragment_table_index); - return TRUE; - } - -@@ -62,7 +63,7 @@ int read_fragment_table_2(long long *dir - "fragment table\n"); - - if(swap) { -- unsigned int sfragment_table_index[indexes]; -+ unsigned int* sfragment_table_index = malloc(indexes * sizeof(unsigned int)); - - res = read_fs_bytes(fd, sBlk.s.fragment_table_start, - SQUASHFS_FRAGMENT_INDEX_BYTES_2(sBlk.s.fragments), -@@ -70,10 +71,14 @@ int read_fragment_table_2(long long *dir - if(res == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table index\n"); -+ free(sfragment_table_index); -+ free(fragment_table_index); - return FALSE; - } - SQUASHFS_SWAP_FRAGMENT_INDEXES_2(fragment_table_index, - sfragment_table_index, indexes); -+ -+ free(sfragment_table_index); - } else { - res = read_fs_bytes(fd, sBlk.s.fragment_table_start, - SQUASHFS_FRAGMENT_INDEX_BYTES_2(sBlk.s.fragments), -@@ -81,6 +86,7 @@ int read_fragment_table_2(long long *dir - if(res == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table index\n"); -+ free(fragment_table_index); - return FALSE; - } - } -@@ -96,6 +102,7 @@ int read_fragment_table_2(long long *dir - if(length == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table block\n"); -+ free(fragment_table_index); - return FALSE; - } - } -@@ -111,6 +118,7 @@ int read_fragment_table_2(long long *dir - } - - *directory_table_end = fragment_table_index[0]; -+ free(fragment_table_index); - return TRUE; - } - -diff -aurp a/squashfs-tools/unsquash-3.c b/squashfs-tools/unsquash-3.c ---- a/squashfs-tools/unsquash-3.c 2014-09-18 20:16:18.000000000 -0600 -+++ b/squashfs-tools/unsquash-3.c 2017-08-29 14:43:17.016089289 -0600 -@@ -32,7 +32,7 @@ int read_fragment_table_3(long long *dir - int res, i; - int bytes = SQUASHFS_FRAGMENT_BYTES_3(sBlk.s.fragments); - int indexes = SQUASHFS_FRAGMENT_INDEXES_3(sBlk.s.fragments); -- long long fragment_table_index[indexes]; -+ long long* fragment_table_index = malloc(indexes * sizeof(long long)); - - TRACE("read_fragment_table: %d fragments, reading %d fragment indexes " - "from 0x%llx\n", sBlk.s.fragments, indexes, -@@ -40,6 +40,7 @@ int read_fragment_table_3(long long *dir - - if(sBlk.s.fragments == 0) { - *directory_table_end = sBlk.s.fragment_table_start; -+ free(fragment_table_index); - return TRUE; - } - -@@ -49,7 +50,7 @@ int read_fragment_table_3(long long *dir - "fragment table\n"); - - if(swap) { -- long long sfragment_table_index[indexes]; -+ long long* sfragment_table_index = malloc(indexes * sizeof(long long)); - - res = read_fs_bytes(fd, sBlk.s.fragment_table_start, - SQUASHFS_FRAGMENT_INDEX_BYTES_3(sBlk.s.fragments), -@@ -57,10 +58,13 @@ int read_fragment_table_3(long long *dir - if(res == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table index\n"); -+ free(fragment_table_index); -+ free(sfragment_table_index); - return FALSE; - } - SQUASHFS_SWAP_FRAGMENT_INDEXES_3(fragment_table_index, - sfragment_table_index, indexes); -+ free(sfragment_table_index); - } else { - res = read_fs_bytes(fd, sBlk.s.fragment_table_start, - SQUASHFS_FRAGMENT_INDEX_BYTES_3(sBlk.s.fragments), -@@ -68,6 +72,7 @@ int read_fragment_table_3(long long *dir - if(res == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table index\n"); -+ free(fragment_table_index); - return FALSE; - } - } -@@ -83,6 +88,7 @@ int read_fragment_table_3(long long *dir - if(length == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table block\n"); -+ free(fragment_table_index); - return FALSE; - } - } -@@ -98,6 +104,7 @@ int read_fragment_table_3(long long *dir - } - - *directory_table_end = fragment_table_index[0]; -+ free(fragment_table_index); - return TRUE; - } - -diff -aurp a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c ---- a/squashfs-tools/unsquash-4.c 2014-09-18 20:16:18.000000000 -0600 -+++ b/squashfs-tools/unsquash-4.c 2017-08-29 14:49:01.424441708 -0600 -@@ -33,7 +33,7 @@ int read_fragment_table_4(long long *dir - int res, i; - int bytes = SQUASHFS_FRAGMENT_BYTES(sBlk.s.fragments); - int indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments); -- long long fragment_table_index[indexes]; -+ long long* fragment_table_index = malloc(indexes * sizeof(long long)); - - TRACE("read_fragment_table: %d fragments, reading %d fragment indexes " - "from 0x%llx\n", sBlk.s.fragments, indexes, -@@ -41,6 +41,7 @@ int read_fragment_table_4(long long *dir - - if(sBlk.s.fragments == 0) { - *directory_table_end = sBlk.s.fragment_table_start; -+ free(fragment_table_index); - return TRUE; - } - -@@ -55,6 +56,7 @@ int read_fragment_table_4(long long *dir - if(res == FALSE) { - ERROR("read_fragment_table: failed to read fragment table " - "index\n"); -+ free(fragment_table_index); - return FALSE; - } - SQUASHFS_INSWAP_FRAGMENT_INDEXES(fragment_table_index, indexes); -@@ -70,6 +72,7 @@ int read_fragment_table_4(long long *dir - if(length == FALSE) { - ERROR("read_fragment_table: failed to read fragment " - "table index\n"); -+ free(fragment_table_index); - return FALSE; - } - } -@@ -78,6 +81,7 @@ int read_fragment_table_4(long long *dir - SQUASHFS_INSWAP_FRAGMENT_ENTRY(&fragment_table[i]); - - *directory_table_end = fragment_table_index[0]; -+ free(fragment_table_index); - return TRUE; - } - -@@ -356,13 +360,14 @@ int read_uids_guids_4() - int res, i; - int bytes = SQUASHFS_ID_BYTES(sBlk.s.no_ids); - int indexes = SQUASHFS_ID_BLOCKS(sBlk.s.no_ids); -- long long id_index_table[indexes]; -+ long long* id_index_table = malloc(indexes * sizeof(long long)); - - TRACE("read_uids_guids: no_ids %d\n", sBlk.s.no_ids); - - id_table = malloc(bytes); - if(id_table == NULL) { - ERROR("read_uids_guids: failed to allocate id table\n"); -+ free(id_index_table); - return FALSE; - } - -@@ -370,6 +375,7 @@ int read_uids_guids_4() - SQUASHFS_ID_BLOCK_BYTES(sBlk.s.no_ids), id_index_table); - if(res == FALSE) { - ERROR("read_uids_guids: failed to read id index table\n"); -+ free(id_index_table); - return FALSE; - } - SQUASHFS_INSWAP_ID_BLOCKS(id_index_table, indexes); -@@ -382,11 +388,13 @@ int read_uids_guids_4() - if(res == FALSE) { - ERROR("read_uids_guids: failed to read id table block" - "\n"); -+ free(id_index_table); - return FALSE; - } - } - - SQUASHFS_INSWAP_INTS(id_table, sBlk.s.no_ids); - -+ free(id_index_table); - return TRUE; - } -diff -aurp a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c ---- a/squashfs-tools/unsquashfs.c 2017-08-29 14:58:51.917037533 -0600 -+++ b/squashfs-tools/unsquashfs.c 2017-08-29 13:14:03.082818149 -0600 -@@ -691,7 +691,7 @@ int read_block(int fd, long long start, - return 0; - - if(compressed) { -- char buffer[c_byte]; -+ char* buffer = malloc(c_byte); - int error; - - res = read_fs_bytes(fd, start + offset, c_byte, buffer); -@@ -704,8 +704,10 @@ int read_block(int fd, long long start, - if(res == -1) { - ERROR("%s uncompress failed with error code %d\n", - comp->name, error); -+ free(buffer); - goto failed; - } -+ free(buffer); - } else { - res = read_fs_bytes(fd, start + offset, c_byte, block); - if(res == FALSE) -@@ -2097,7 +2099,7 @@ void *writer(void *arg) - */ - void *inflator(void *arg) - { -- char tmp[block_size]; -+ char* tmp = malloc(block_size); - - while(1) { - struct cache_entry *entry = queue_get(to_inflate); -@@ -2120,6 +2122,7 @@ void *inflator(void *arg) - */ - cache_block_ready(entry, res == -1); - } -+ free(tmp); - } - - -diff -aurp a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c ---- a/squashfs-tools/mksquashfs.c 2017-09-05 15:09:19.090937121 -0600 -+++ b/squashfs-tools/mksquashfs.c 2017-09-01 09:58:11.274529037 -0600 -@@ -652,7 +652,7 @@ long long write_directories() - long long write_id_table() - { - unsigned int id_bytes = SQUASHFS_ID_BYTES(id_count); -- unsigned int p[id_count]; -+ unsigned int* p = malloc(id_count * sizeof(unsigned int)); - int i; - - TRACE("write_id_table: ids %d, id_bytes %d\n", id_count, id_bytes); -@@ -655,6 +655,9 @@ long long write_id_table() - unsigned int* p = malloc(id_count * sizeof(unsigned int)); - int i; - -+ if(p == NULL) -+ MEM_ERROR(); -+ - TRACE("write_id_table: ids %d, id_bytes %d\n", id_count, id_bytes); - for(i = 0; i < id_count; i++) { - TRACE("write_id_table: id index %d, id %d", i, id_table[i]->id); - -@@ -661,6 +661,7 @@ long long write_id_table() - SQUASHFS_SWAP_INTS(&id_table[i]->id, p + i, 1); - } - -+ free(p); - return generic_write_table(id_bytes, p, 0, NULL, noI); - } - -diff -aurp a/squashfs-tools/read_fs.c b/squashfs-tools/read_fs.c ---- a/squashfs-tools/read_fs.c 2014-09-18 20:16:18.000000000 -0600 -+++ b/squashfs-tools/read_fs.c 2017-09-05 15:35:19.328547536 -0600 -@@ -77,18 +77,24 @@ int read_block(int fd, long long start, - return 0; - - if(compressed) { -- char buffer[c_byte]; -+ char* buffer = malloc(c_byte); - int error; - -+ if(buffer == NULL) -+ MEM_ERROR(); -+ - res = read_fs_bytes(fd, start + 2, c_byte, buffer); -- if(res == 0) -+ if(res == 0) { -+ free(buffer); - return 0; -+ } - - res = compressor_uncompress(comp, block, buffer, c_byte, - outlen, &error); - if(res == -1) { - ERROR("%s uncompress failed with error code %d\n", - comp->name, error); -+ free(buffer); - return 0; - } - } else { -@@ -699,7 +705,7 @@ all_done: - unsigned int *read_id_table(int fd, struct squashfs_super_block *sBlk) - { - int indexes = SQUASHFS_ID_BLOCKS(sBlk->no_ids); -- long long index[indexes]; -+ long long* index; - int bytes = SQUASHFS_ID_BYTES(sBlk->no_ids); - unsigned int *id_table; - int res, i; -@@ -708,12 +714,17 @@ unsigned int *read_id_table(int fd, stru - if(id_table == NULL) - MEM_ERROR(); - -+ index = malloc(indexes * sizeof(long long)); -+ if(index == NULL) -+ MEM_ERROR(); -+ - res = read_fs_bytes(fd, sBlk->id_table_start, - SQUASHFS_ID_BLOCK_BYTES(sBlk->no_ids), index); - if(res == 0) { - ERROR("Failed to read id table index\n"); - ERROR("Filesystem corrupted?\n"); - free(id_table); -+ free(index); - return NULL; - } - -@@ -732,6 +743,7 @@ unsigned int *read_id_table(int fd, stru - "length %d\n", i, index[i], length); - ERROR("Filesystem corrupted?\n"); - free(id_table); -+ free(index); - return NULL; - } - } -@@ -753,14 +765,19 @@ int read_fragment_table(int fd, struct s - int res, i; - int bytes = SQUASHFS_FRAGMENT_BYTES(sBlk->fragments); - int indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk->fragments); -- long long fragment_table_index[indexes]; -+ long long* fragment_table_index = malloc(indexes * sizeof(long long)); -+ -+ if(fragment_table_index == NULL) -+ MEM_ERROR(); - - TRACE("read_fragment_table: %d fragments, reading %d fragment indexes " - "from 0x%llx\n", sBlk->fragments, indexes, - sBlk->fragment_table_start); - -- if(sBlk->fragments == 0) -+ if(sBlk->fragments == 0) { -+ free(fragment_table_index); - return 1; -+ } - - *fragment_table = malloc(bytes); - if(*fragment_table == NULL) -@@ -773,6 +790,7 @@ int read_fragment_table(int fd, struct s - ERROR("Failed to read fragment table index\n"); - ERROR("Filesystem corrupted?\n"); - free(*fragment_table); -+ free(fragment_table_index); - return 0; - } - -@@ -792,6 +810,7 @@ int read_fragment_table(int fd, struct s - fragment_table_index[i], length); - ERROR("Filesystem corrupted?\n"); - free(*fragment_table); -+ free(fragment_table_index); - return 0; - } - } -@@ -799,6 +818,7 @@ int read_fragment_table(int fd, struct s - for(i = 0; i < sBlk->fragments; i++) - SQUASHFS_INSWAP_FRAGMENT_ENTRY(&(*fragment_table)[i]); - -+ free(fragment_table_index); - return 1; - } - -@@ -808,11 +828,16 @@ int read_inode_lookup_table(int fd, stru - { - int lookup_bytes = SQUASHFS_LOOKUP_BYTES(sBlk->inodes); - int indexes = SQUASHFS_LOOKUP_BLOCKS(sBlk->inodes); -- long long index[indexes]; -+ long long* index = malloc(indexes * sizeof(long long)); - int res, i; - -- if(sBlk->lookup_table_start == SQUASHFS_INVALID_BLK) -+ if(index == NULL) -+ MEM_ERROR(); -+ -+ if(sBlk->lookup_table_start == SQUASHFS_INVALID_BLK) { -+ free(index); - return 1; -+ } - - *inode_lookup_table = malloc(lookup_bytes); - if(*inode_lookup_table == NULL) -@@ -824,6 +849,7 @@ int read_inode_lookup_table(int fd, stru - ERROR("Failed to read inode lookup table index\n"); - ERROR("Filesystem corrupted?\n"); - free(*inode_lookup_table); -+ free(index); - return 0; - } - -@@ -843,12 +869,14 @@ int read_inode_lookup_table(int fd, stru - length); - ERROR("Filesystem corrupted?\n"); - free(*inode_lookup_table); -+ free(index); - return 0; - } - } - - SQUASHFS_INSWAP_LONG_LONGS(*inode_lookup_table, sBlk->inodes); - -+ free(index); - return 1; - } - diff --git a/utils/squashfs-tools/patches/0005-mksquashfs-unsquashfs-fix-compilation-with-glibc-2.2.patch b/utils/squashfs-tools/patches/0005-mksquashfs-unsquashfs-fix-compilation-with-glibc-2.2.patch deleted file mode 100644 index 39c781f8c..000000000 --- a/utils/squashfs-tools/patches/0005-mksquashfs-unsquashfs-fix-compilation-with-glibc-2.2.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 968aa53dd6d2c0831a9af01873441767c06b88d0 Mon Sep 17 00:00:00 2001 -From: Thomas De Schampheleire -Date: Wed, 1 Aug 2018 12:17:10 +0200 -Subject: [PATCH] mksquashfs/unsquashfs: fix compilation with glibc 2.25+ -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From glibc 2.25 release notes: -https://sourceware.org/ml/libc-alpha/2017-02/msg00079.html -"* The inclusion of by is deprecated. - This means that in a future release, the macros “major”, “minor”, and - “makedev” will only be available from ." - -See glibc bug https://sourceware.org/bugzilla/show_bug.cgi?id=19239 . ---- - squashfs-tools/mksquashfs.c | 1 + - squashfs-tools/unsquashfs.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c -index d696a51..8d57c3e 100644 ---- a/squashfs-tools/mksquashfs.c -+++ b/squashfs-tools/mksquashfs.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c -index a57f85c..a492b27 100644 ---- a/squashfs-tools/unsquashfs.c -+++ b/squashfs-tools/unsquashfs.c -@@ -33,6 +33,7 @@ - #include "fnmatch_compat.h" - - #include -+#include - #include - #include - #include --- -2.21.0 -