Calculates 16 bit values incorrectly

Bug #519263 reported by Linus Törngren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ghex (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: ghex

Expected GHex to calculate the 16 bit unsigned value to 512 when selecting 0x0002 (little endian).

I have found that it matters if I select the higher byte first or the lower byte first. It seems that GHex calculates the number of selected bytes and then reads the bytes from where the pointer is at the moment. I have attached a screen shot that depicts the miscalculation.

elprogrammet@elprogrammet-laptop:~$ lsb_release -rd
Description: Ubuntu 9.10
Release: 9.10

elprogrammet@elprogrammet-laptop:~$ apt-cache policy ghex
ghex:
  Installed: 2.24.0-1
  Candidate: 2.24.0-1
  Version table:
 *** 2.24.0-1 0
        500 http://se.archive.ubuntu.com karmic/universe Packages
        100 /var/lib/dpkg/status

Revision history for this message
Linus Törngren (etnolit) wrote :
Revision history for this message
Phlip (q-launchpad-mrphlip-com) wrote :

ghex calculates the multi-byte values not on the selection, but on the cursor and the following bytes... so for a 16-bit value, you should just select the first byte of the pair. In your screenshot, you have offset 0xC selected, so it will use the bytes in offsets 0xC and 0xD to calculate the 16-bit number, which is 0x0202, or 514, as it shows. If you move the cursor to offset 0xB, it would show 512 as expected.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.