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

segfault on hitting F key in Mageia #19

Closed barjac closed 2 years ago

barjac commented 4 years ago

I maintain vbindiff for Mageia and have just been alerted to this bug report: https://bugs.mageia.org/show_bug.cgi?id=26780 I am suspecting that it is maybe 6 months old as it is affecting our current stable release and the development branch.

ncurses in Mga7 is ncurses-6.1-20181117.3.1.mga7 which was a snapshot on 17 Nov 2018.

Building locally in Mga7 using current upstream git master clone (manual build and run from build tree without packaging) produces a similar segfault: ` Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7f867a4 in wresize (win=, ToLines=2, ToCols=31, ToCols@entry=32) at ../../ncurses/base/wresize.c:161 161 if (s == 0) (gdb) bt

0 0x00007ffff7f867a4 in wresize (win=, ToLines=2, ToCols=31, ToCols@entry=32)

at ../../ncurses/base/wresize.c:161

1 0x0000000000407ed5 in ConWindow::resize (this=this@entry=0x40d860 , width=width@entry=32,

height=height@entry=3) at curses/ConWin.cpp:239

2 0x000000000040500a in positionInWin (cmd=cmd@entry=19 '\023', width=width@entry=32,

title=title@entry=0x409619 " Find ") at vbindiff.cpp:1280

3 0x0000000000406dd1 in searchFiles (cmd=19 '\023') at vbindiff.cpp:1635

4 0x0000000000407237 in handleCmd (cmd=) at vbindiff.cpp:1676

5 0x0000000000403878 in main (argc=, argv=) at vbindiff.cpp:1868`

barjac commented 2 years ago

Any comment on this please?

linuxCowboy commented 2 years ago

It's the same source in debian (my distro) and mageia:

 $ wget http://ftp.free.fr/mirrors/mageia.org/distrib/8/SRPMS/core/release/vbindiff-3.0-0.8.beta5.mga8.src.rpm

 $ rpm2cpio vbindiff-3.0-0.8.beta5.mga8.src.rpm |cpio -iv
vbindiff-3.0_beta5.tar.gz

 $ wget http://deb.debian.org/debian/pool/main/v/vbindiff/vbindiff_3.0-beta5.orig.tar.gz

 $ ls -l vbindiff-3.0_beta5.tar.gz vbindiff_3.0-beta5.orig.tar.gz
-rw-r--r-- 1 lxc lxc 128,406 Oct 25  2017 vbindiff_3.0-beta5.orig.tar.gz
-rw-r--r-- 1 lxc lxc 128,406 Feb 21 13:32 vbindiff-3.0_beta5.tar.gz

 $ diff -s vbindiff-3.0_beta5.tar.gz vbindiff_3.0-beta5.orig.tar.gz
Files vbindiff-3.0_beta5.tar.gz and vbindiff_3.0-beta5.orig.tar.gz are identical

I got your build:

 $ wget https://mirror.tuxinator.org/mageia/distrib/8/x86_64/media/core/release/vbindiff-3.0-0.8.beta5.mga8.x86_64.rpm

 $ rpm2cpio vbindiff-3.0-0.8.beta5.mga8.x86_64.rpm |cpio -ivd
./usr/bin/vbindiff

It failed in debian too:

 $ ./usr/bin/vbindiff vbindiff-3.0-0.8.beta5.mga8.src.rpm

Segmentation fault

 $ reset

You could try my patches? I implemented the searches new.

(But I don't think Mr. Madsen's code is faulty.)

rofl0r commented 2 years ago

vbindiff is a buggy, unmaintained PoS (piece of software) written in a horrible, unmaintainable language (C++). that's why i long gave up on it and you should too. you can use haxdiff ( https://github.com/rofl0r/haxdiff ) + an editor that has syntax highlighting for diffs to replace it.

barjac commented 2 years ago

You could try my patches? I implemented the searches new.

Where are they? I see no patches in the Debian sources.

linuxCowboy commented 2 years ago

@barjac

I see you still haven't fixed your Mageia probs!

From your dump its visible that wresize is called with 4 args instead of 3?

@rofl0r

vbindiff is (for me) first of all a quick hexviewer. I don't see how haxdiff can compete with that.

And it's okay for me to get only the source of a good program. There is no obligation for a lifelong support!

barjac commented 2 years ago

@barjac

I see you still haven't fixed your Mageia probs!

From your dump its visible that wresize is called with 4 args instead of 3?

Where? I only see it used once in ConWindow::resize with 3 params. if (wresize(win, height, width) != OK) Are you suggesting that our optimization is causing this? I am not a programmer so if you can offer more than cryptic comments I would appreciate your help. ;)

linuxCowboy commented 2 years ago

"cryptic comments"... hmm...

It looks like a widechar problem to me.

And indeed, install the ncurses utf8 development libraries

lib64ncursesw-devel

run

./configure LIBS="-lncursesw -lpanelw" && make

and vbindiff is back in the game!

Tested with Mageia 8 Live Xfce 64bit

barjac commented 2 years ago

"cryptic comments"... hmm... :-)

Many thanks for you help - much appreciated - fix now pushed in Mageia 8 updates_testing and in cauldron.