madsen / vbindiff

Visual Binary Diff (VBinDiff) displays files in hex & ASCII and can highlight the differences between 2 files
479 stars 52 forks source link

Vbindiff crashes when comparing some files #7

Open Ganton opened 9 years ago

Ganton commented 9 years ago

SUMMARY

Vbindiff crashes when comparing some files.

ENVIRONMENT INFORMATION

lsb_release -a shows: [...] Ubuntu 14.04.2 LTS [...]

vbindiff --version shows: VBinDiff 3.0_beta4 Copyright 1995-2008 Christopher J. Madsen

STEPS TO REPRODUCE

Execute: wget https://cloud.githubusercontent.com/assets/2103153/8145148/24394c2a-11fc-11e5-95f9-115ba65c96df.png wget https://cloud.githubusercontent.com/assets/2103153/8145146/13179848-11fc-11e5-8d0e-d183d183a417.png vbindiff *.png

Press the End key, press Enter. See the crash of Vbindiff.

It also happens if the user presses the B key instead of the End key. Sometimes pressing the Enter key is not necessary to experiment the crash.

ADDITIONAL COMMENTS

:-) Thank you for Vbindiff!

dewhisna commented 8 years ago

I think this is related to the crash I'm seeing -- also on an Ubuntu 14.04 LTS Trusty Tahr environment. What I'm finding is that it crashes for me if the two files aren't the same length. The crash usually happens when scrolling down, usually a page-down operation, and you reach the point where it runs out of content for one of the two files.

To work around this issue, I simply cat on some zero bytes from /dev/zero to a temp copy of the shorter file. For example, suppose file1.bin is 1234 bytes and file2.bin is 2345 bytes, I'll add 1111 extra 0x00 bytes to file1.bin in a temporary copy with something like:

dd if=/dev/zero bs=1 count=1111 | cat file1.bin - >file1_temp.bin
vbindiff file1_temp.bin file2.bin

So far, it hasn't crashed on me if they are the same size. The only real nuisance is having to calculate how many extra bytes to add and delete the temporary when done. I suppose I could script that, but eh...

PS. Yes, thanks, Christopher, for VBinDiff -- it's a very handy little tool.