AgentD / squashfs-tools-ng

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

Hard link detection doesn't scale well #38

Closed AgentD closed 4 years ago

AgentD commented 4 years ago

Currently, the hard link detection iterates over all inodes linearly, and inside that loop iterates over all previous nodes to find one with the same inode number. This scales quadratically with larger SquashFS images and makes sqfs2tar and rdsquashfs hang for a very long time for any sufficiently large image.

The problem is, we cannot directly use the inode numbers as table indices, because they are untrusted and may be larger than what the super block told us. It should be pretty straight forward to replace the linear search with a hash table.