charles2gan / charles2gan/firmware-mod-kit

unsquashfs segfault on 64bit machines

Open
#121 3 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
C
Stars
7
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
Using binwalk with the -e option in order to extract an squashfs ends up in
segmentation fault of a tool inside FMK.

Working with
http://212.166.190.34/zonadescargas/AI_VA_DD_HG556aV100R001C10B077.zip

$ binwalk -e HG556aV100R001C10B077.bin -vv

Scan Time: 2013-11-12 09:06:36
Signatures: 212
Target File: HG556aV100R001C10B077.bin
MD5 Checksum: 45c8569283fa78cd5033c2f55651baca

DECIMAL HEX DESCRIPTION
--------------------------------------------------------------------------------
-----------------------------------
File "./src/binwalk-1.0/src/bin/binwalk-script", line 14
print "Progress: %.2f%% (%d / %d)\n" % (((float(bwalk.total_scanned) / float(bwalk.scan_length)) * 100), bwalk.total_scanned, bwalk.scan_length)
^
SyntaxError: invalid syntax
Attempting to extract SquashFS .X file system...

Trying ./src/squashfs-2.1-r2/unsquashfs-lzma...
created 80 files
created 75 directories
created 80 symlinks
created 0 devices
created 0 fifos

Trying ./src/squashfs-2.1-r2/unsquashfs...
created 80 files
created 75 directories
created 80 symlinks
created 0 devices
created 0 fifos

Trying ./src/squashfs-3.0/unsquashfs-lzma...
Trying ./src/squashfs-3.0/unsquashfs...
Trying ./src/squashfs-3.0-lzma-damn-small-variant/unsquashfs-lzma...
Trying ./src/others/squashfs-2.0-nb4/unsquashfs...
/opt/firmware-mod-kit/unsquashfs_all.sh: line 38: 2917 Segmentation fault
(core dumped) $unsquashfs $DEST $IMG 2> /dev/null
File system sucessfully extracted!
MKFS="./src/others/squashfs-2.0-nb4/mksquashfs"
256 0x100 Squashfs filesystem, big endian, version 2.0, size:
10363625 bytes, 1195 inodes, blocksize: 8192 bytes, created: Sun Jun 3
23:05:46 2012

As it turns out, this only happens in 64bit machines context, running perfectly
on 32bit ones.

If you are not willing to debug and fix this beware that I will attempt to when
I have more time, so please don't mark instantaniously as wont fix.

Thanks in advance.
```

Original issue reported on code.google.com by `antoniov...@gmail.com` on 16 Nov 2013 at 3:35

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the extraction with the linked HG556aV100R001C10B077.bin image and inspect unsquashfs_all.sh at line 38, where the unsquashfs command segfaults. Compare the listed SquashFS 2.0 and 3.0 unsquashfs binaries on 32-bit and 64-bit systems, then verify that extraction completes without a segmentation fault and produces the expected filesystem contents.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.