AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
196 stars 30 forks source link

gensquashfs: free(): invalid next size (fast) with --pack-dir #18

Closed aparcar closed 5 years ago

aparcar commented 5 years ago

I'm trying to integrate this in OpenWrt but get this (not very verbose) error. It worked previously on other folders. What other information can I provide?

a@reboot:~/src/openwrt/openwrt$ /home/a/src/openwrt/openwrt/staging_dir/host/bin/gensquashfs -f --pack-dir /home/a/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/root-ath79 /home/a/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/root.squashfs
free(): invalid next size (fast)
Aborted
aparcar commented 5 years ago

The full code around that is here https://github.com/aparcar/openwrt/pull/1

AgentD commented 5 years ago

Hi!

From the glibc error message it might be a double free, a free of something not on the heap or at worst a buffer overrun somewhere.

Perhaps compiling with ASAN and using a debugger might provide some more insight.

Do you know what the difference with this one is? Some obscure hardlink constructs?

I just launched a build of your OpenWRT tree with default config, so I can look into it on my end too.

aparcar commented 5 years ago

I'm very unfamiliar with C debugging, I'm afraid I can't be much of a help here...

AgentD commented 5 years ago

Does applying the patch below help?

https://infraroot.at/pub/squashfs/patches-0.6.1/0001-Fix-safe-string-allocation-wrapper.patch

aparcar commented 5 years ago

Works now

aparcar commented 5 years ago

Please add another tag like 0.6.2 and I'll update the OpenWrt package

AgentD commented 5 years ago

I'd rather not create another patch level release for a pre-1.0.0 version that is about to be superseded by the next minor version release soon[ish]. Especially for a single line change.

One option would be using the official release tarballs from here and applying a patch in the package build script.

In contrast to the github tarballs, those also don't need you to run autoreconf.

If it helps, I created a branch called fixes-0.6.1 where I back-ported the patch. But again, going forward that's something I'd rather continue doing after 1.0.0.

aparcar commented 5 years ago

No problem, the OpenWrt build system supports both autoreconf and applying patches automatically.