Skip to content

[BUG]The offset of the RUST STRINGS is misaligned. #925

@pinksawtooth

Description

@pinksawtooth

Description

The offset of the "FLOSS RUST STRINGS" item in "FLOSS" is different from the actual value.

The following is an excerpt of the results of running floss on a Rust program I created.

 ──────────────────────────
  FLOSS RUST STRINGS (529)
 ──────────────────────────

0x01d590 invalid args
0x01d5b0 /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1\library\core\src\fmt\mod.rs
0x01d618 /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1\library\core\src\alloc\layout.rs
0x01d680 attempt to divide by zero
0x01d699 February
0x01d6a1 March
0x01d6a6 April
0x01d6ae June
0x01d6b2 July
0x01d6b6 August
0x01d6bc September
0x01d6c5 October
0x01d6cc November
0x01d6d4 December
0x01d6dc January
0x01d6e3 initial contents
0x01d6f3 to string:
0x01d720 Hello,
0x01d727 world!
0x01d72d add string:
0x01d760 global static:
0x01d790 global const:
0x01d7c0 This is const variableA
0x01d7e8 This is const variableB
0x01d810 This is const variableC
0x01d838 month:
0x01d860 This is static variableA
0x01d888 This is static variableB
0x01d8b0 This is static variableC
(snip)

This time I will focus on this string. (The problem is the same for all strings.)
0x01d720 Hello,

But the actual offset is 0x1e520 as shown in the image below.
image

>>> hex(0x1e520-0x01d720)
'0xe00'

The other strings are offset by the same amount. Verify with the following string

0x01d760 global static:`

Add 0xe00 to this offset.

>>> hex(0x1d760+0xe00)
'0x1e560'

Then the actual offset value will be displayed as follows.
14001e560

image

I believe it is a bug in Rust Strings because the offset in static strings is normal.

+------------------------------------+
| FLOSS STATIC STRINGS: ASCII (2336) |
+------------------------------------+

0x00004d !This program cannot be run in DOS mode.

image

To Reproduce

Run floss with the -v option for the Rust program.

Environment

floss version

.\floss.exe --version
floss.exe v3.0.1-0-g3782dc9

Rust version

rustc --version
rustc 1.74.1 (a28077b28 2023-12-04)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions