8051Enthusiast / biodiff

Hex diff viewer using alignment algorithms from biology
MIT License
818 stars 27 forks source link

Glitch in the alignment algo? #16

Closed doegox closed 5 months ago

doegox commented 11 months ago

Hello, I just wanted to share what looks like a glitch in the alignment algo, see pic. There is a whole segment at the bottom that was flagged as entirely different between the 2 files (in green 20 68 ff f7 ... 5b 00 20) rather than keeping alignment and spotting diffs. It occurs at about 0x3800, 1.75x the block size 8192.

bindiff

The weird thing is that while writing this bugreport, I could not reproduce the issue... Maybe the algo starts with a random seed? So if you want to dig into it, I can share both files (2Mb each), or feel free to just ignore and close this issue.

8051Enthusiast commented 11 months ago

i suspect this issue probably depends on the location where the alignment was started (there should not be any random seeding that i know of, but i might be wrong), do you remember whether you started the alignment in a specific place? and i would be interested in trying to reproduce this, so could you share the files? i will be somewhat busy in the near time so i won't be able to look at this very soon, but it'd still be nice to have the files for the future.

doegox commented 11 months ago

So the algo execution depends on where the cursor is ? or on which section is currently displayed? I sent you the files on your protonmail.

doegox commented 11 months ago

ok I could reproduce, if you move cursor to 0x3804 then F3, then because we're at a position where files are misaligned, it fails at realigning data which is before cursor in file A with data after cursor in file B.

8051Enthusiast commented 11 months ago

thanks for the files!

yeah, i can see the issue. the block aligner starts at the cursor in both directions independently and doesn't see the bytes on the other side of the cursor. it probably makes sense to instead make a single starting block whose center is at the cursor and after that continue in both directions. (i normally don't encounter this issue because i already make both files line up in unaligned mode)

doegox commented 11 months ago

yeah these files have additional segments in the middle that change locally the alignment. So for me it was a really nice example to test the bio algo :) Indeed centering the block window around the cursor sounds interesting! Thanks for having taken the time to look at it :)

8051Enthusiast commented 5 months ago

Sorry for the long time, I have made it so that the first block is centered around the cursor on current main

doegox commented 5 months ago

Oh great, thanks! Looking forward to the release ;)