After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 648644 - GHex2 cannot read properly float 64 in big-endian files
GHex2 cannot read properly float 64 in big-endian files
Status: RESOLVED DUPLICATE of bug 625968
Product: ghex
Classification: Applications
Component: general
2.24.x
Other Linux
: Normal major
: ---
Assigned To: GHex maintainers
GHex maintainers
Depends on:
Blocks:
 
 
Reported: 2011-04-25 21:11 UTC by Laurent Maurin
Modified: 2011-09-16 20:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
big endian file format (2.36 KB, application/octet-stream)
2011-04-25 21:11 UTC, Laurent Maurin
Details
little endian file format (with same data) (2.36 KB, application/octet-stream)
2011-04-26 10:28 UTC, Laurent Maurin
Details
double C type number read in little-endian file format (screen copy) (112.15 KB, image/png)
2011-04-27 17:18 UTC, Laurent Maurin
Details
double C type number read in big-endian file format (screen copy) (111.68 KB, image/png)
2011-04-27 17:20 UTC, Laurent Maurin
Details
double C type number read in big-endian file format 4 bytes backwards (screen copy) (108.51 KB, image/png)
2011-04-27 17:25 UTC, Laurent Maurin
Details

Description Laurent Maurin 2011-04-25 21:11:39 UTC
Created attachment 186619 [details]
big endian file format

C double 64 bits type floating numbers cannot be read properly when it is encoded in big endian format, and read on little-endian platform

the pointer has to be shifted 4 bytes forward to be able to "see" the right number

in the attached file encoded in big-endian format, at position 0x10=16, there is the double number which should be roughly equal to 1538.383

in fact, it is read to be equal to 2,895473e-287 (but it is not the right value)

you can "read" it properly if you are placed 4 bytes forward at position 0xC=12

my distribution : Fedora 14 x86_64
my PC : Intel Core2 Quad 9400

my Ghex rpm is : ghex-2.24.0-5.fc13.x86_64

if you can read french, see also : http://forums.fedora-fr.org/viewtopic.php?id=52188
Comment 1 Laurent Maurin 2011-04-26 10:28:24 UTC
Created attachment 186646 [details]
little endian file format (with same data)

attached file is filled with the same data, but recorded as little endian

you can now compare the two files with Ghex

the bug appears at byte # 0x10=16, and at least for the 99 following double numbers
Comment 2 Laurent Maurin 2011-04-27 17:18:25 UTC
Created attachment 186759 [details]
double C type number read in little-endian file format (screen copy)

double C type number read in little-endian file format

pointer is at position 0x10=16

the number is equal to 1538.383

this is the right value

related to attached file entitled 'little'
Comment 3 Laurent Maurin 2011-04-27 17:20:59 UTC
Created attachment 186761 [details]
double C type number read in big-endian file format (screen copy)

double C type number read in big-endian file format

pointer is at position 0x10=16

the number is equal in this case to 2.895473e-287 (it should be equal to 1538.383)

this is NOT the right value

related to previously attached file entitled 'big'
Comment 4 Laurent Maurin 2011-04-27 17:25:48 UTC
Created attachment 186763 [details]
double C type number read in big-endian file format 4 bytes backwards (screen copy)

double C type number read in big-endian file format, but 4 bytes backwards

pointer is now at position 0xC=12 (it should be 0x10=16, see below)

the number is equal in this case to "expected" value 1538.383, but he pointer is NOT at the right place

related to previously attached file entitled 'big'
Comment 5 Kalev Lember 2011-09-05 23:57:52 UTC
GHex was largely unmaintained for several years, but I'm now working on getting a new release out.

The sample files, screenshots and comments here are really good and helped me a lot when dealing with the issue. Thanks for taking the time to do that!

I'm going to mark this ticket as a duplicate with #625968 just because they are both about the same bug and there's a patch in there. Make no mistake, all the work you did here played a big part to get this issue solved.

*** This bug has been marked as a duplicate of bug 625968 ***
Comment 6 Kalev Lember 2011-09-10 11:16:10 UTC
(In reply to comment #0)
> my distribution : Fedora 14 x86_64
> 
> my Ghex rpm is : ghex-2.24.0-5.fc13.x86_64

Since you mentioned Fedora, you might want to give a try to the Fedora 16 build which has the fix:
https://admin.fedoraproject.org/updates/ghex-2.90.2-1.fc16