NickstaDB / SerializationDumper

A tool to dump Java serialization streams in a more human readable form.
MIT License
992 stars 125 forks source link

readFloatField() and readDoubleField() are implemented incorrectly #26

Closed rgiulietti closed 5 months ago

rgiulietti commented 1 year ago

https://github.com/NickstaDB/SerializationDumper/blob/69ea9ba932e31b78bc376d31650bfdcaef2e6b66/src/nb/deser/SerializationDumper.java#L1418

This is not correct, as it simply converts an int value to a float value. What is needed here, instead, is to invoke Float.intBitsToFloat() on the int.

Similarly in method readDoubleField().

rickhg12hs commented 5 months ago

I can confirm that this is an issue:

...
                  time
                    (array)
                      TC_ARRAY - 0x75
                        TC_REFERENCE - 0x71
                          Handle - 8257848 - 0x00 7e 01 38
                        newHandle 0x00 7e 02 a1
                        Array size - 24 - 0x00 00 00 18
                        Values
                          Index 0:
                            (double)0.0 - 0x00 00 00 00 00 00 00 00
                          Index 1:
                            (double)2.80376289716601E14 - 0x3f 7c ac 08 31 26 e9 79
                          Index 2:
                            (double)7.1777212353732408E16 - 0x3f 92 6e 97 8d 4f df 3b
                          Index 3:
                            (double)7.2057591151709912E16 - 0x3f 9b a5 e3 53 f7 ce d9
                          Index 4:
                            (double)7.2056495625811792E16 - 0x3f b0 e5 60 41 89 37 4c
                          Index 5:
                            (double)7.2056493529867744E16 - 0x3f b2 b0 20 c4 9b a5 e3
                          Index 6:
                            (double)7.1776120366887336E16 - 0x3f b8 10 62 4d d2 f1 aa
                          Index 7:
                            (double)7.205649535093388E16 - 0x3f bc ac 08 31 26 e9 79
                          Index 8:
                            (double)7.205649579761048E16 - 0x3f c1 89 37 4b c6 a7 f0
                          Index 9:
                            (double)7.205649497297676E16 - 0x3f c4 dd 2f 1a 9f be 77
                          Index 10:
                            (double)7.2056493736026176E16 - 0x3f c9 db 22 d0 e5 60 42
                          Index 11:
                            (double)7.2056496450445512E16 - 0x3f cd 91 68 72 b0 20 c5
                          Index 12:
                            (double)7.1777215205590696E16 - 0x3f d0 41 89 37 4b c6 a8
                          Index 13:
                            (double)7.1777214621475144E16 - 0x3f d1 47 ae 14 7a e1 48
                          Index 14:
                            (double)7.1777212594250576E16 - 0x3f e0 20 c4 9b a5 e3 54
                          Index 15:
                            (double)7.177721630510232E16 - 0x3f e1 26 e9 78 d4 fd f4
                          Index 16:
                            (double)7.1777215411749128E16 - 0x3f e3 6c 8b 43 95 81 06
                          Index 17:
                            (double)7.2057591564026776E16 - 0x3f e5 fb e7 6c 8b 43 96
                          Index 18:
                            (double)7.1776119714052312E16 - 0x3f e8 08 31 26 e9 78 d5
                          Index 19:
                            (double)7.2056493151910624E16 - 0x3f ea e1 47 ae 14 7a e1
                          Index 20:
                            (double)7.2057588437290584E16 - 0x3f ef ef 9d b2 2d 0e 56
                          Index 21:
                            (double)7.177611830530304E16 - 0x3f f0 62 4d d2 f1 a9 fc
                          Index 22:
                            (double)7.2057589090125608E16 - 0x3f f3 f7 ce d9 16 87 2b
                          Index 23:
                            (double)7.1777213247085608E16 - 0x3f f6 28 f5 c2 8f 5c 29
...
NickstaDB commented 5 months ago

Fixed in v1.14. Thanks.