Bug: Position desync when comparing files.

Bug reports concerning HxD.
Post Reply
rwx
Posts: 3
Joined: 30 Apr 2021 00:16

Bug: Position desync when comparing files.

Post by rwx »

How to reproduce:
1. Open any two different files in HxD 2.5.0.0 x64.
2. Ctrl-K to compare.
3. Press and hold F6 for some time, might need up to a minute or so.
4. Notice that file positions have diverged by 0x20000-1.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Bug: Position desync when comparing files.

Post by Maël »

Can you provide example files, so it's easy/reliable to reproduce?

Here it does not happen under Win8.1 and HxD 2.5.0.0 64 bit.
rwx
Posts: 3
Joined: 30 Apr 2021 00:16

Re: Bug: Position desync when comparing files.

Post by rwx »

Sorry for the late response.
I totally missed one thing, though, and only now that you couldn't manage to reproduce realized it is important - my keyboard key repeat rate is cranked to its maximum setting. Without it the wait would be proportionately longer. Can you change that and try again? The files don't make much difference, you can take literally any two sufficiently different files (so that you won't run into EOF before the bug triggers). Attached a couple, just in case.
I'm on Windows 7 SP1 x64, but I don't think that matters.
Can only guess without seeing the source, but my conjecture is it's a race condition between some sort of readahead and skipping to the next character in comparison. Does the max buffer constant 0x20000 happen to occur in prefetching code?
Attachments
piece1.h
(256 KiB) Downloaded 346 times
piece2.h
(256 KiB) Downloaded 385 times
rwx
Posts: 3
Joined: 30 Apr 2021 00:16

Re: Bug: Position desync when comparing files.

Post by rwx »

The bug is still present and continues to manifest itself in various ways.
In addition to position desync problem there is a failure to properly compare problem.
If current comparison position is less than 0x20000 from EOF, then instead of desyncing HxD will declare "No further differences found". However, after dismissing the dialog the comparison will continue to find differences.
Attached two files that demonstrate both aspects of this bug. If the bug triggers in the first half of these files, then you get desync, if it happens in the second half of these files, then you get erroneous "no differences".

Set keyboard repeat rate to the maximum, drop these two files into HxD, then Ctrl-K to compare. Hold F6 for some time (in my tests I can typically trigger it in less than a minute).
If you wish to see the desync, then start from the beginning, if you wish to see "no differences", then Ctrl-G (goto offset) 0x20000 in both files before starting comparison.

Do note, that you don't need exactly these files, just their structure with mostly the same content and occasional different byte makes the problem immediately visually obvious to the tester.
Attachments
v2_256Ki.h
(256 KiB) Downloaded 275 times
v1_256Ki.h
(256 KiB) Downloaded 279 times
SJocker
Posts: 2
Joined: 06 Dec 2023 20:01

Re: Bug: Position desync when comparing files.

Post by SJocker »

I encountered the same problem on Windows 7 x64, when comparing two .bin files, an offset of 20,000 occurs in one of them when you compare by holding down the F6 button. Has anyone been able to solve this problem?
SJocker
Posts: 2
Joined: 06 Dec 2023 20:01

Re: Bug: Position desync when comparing files.

Post by SJocker »

Installed version 1.7.7.0 works correctly.
Post Reply