hexyl icon indicating copy to clipboard operation
hexyl copied to clipboard

Positions >2^32 cause output to be misaligned

Open apple1417 opened this issue 5 months ago • 1 comments

When dumping things with large positions, which take more than 8 character to display, a few things get misaligned. This happens both when --skiping that far, or when just using a --display-offset to fake the position higher.

Working:

> hexyl -s 0x2f0 -n 0x30 $(which hexyl)
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│000002f0│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│*       │                         ┊                         │        ┊        │
│00000310│ 10 00 00 00 00 00 00 00 ┊ 52 e5 74 64 04 00 00 00 │•⋄⋄⋄⋄⋄⋄⋄┊R×td•⋄⋄⋄│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
> hexyl -s 0x2f0 -n 0x30 $(which hexyl) --border=ascii
+--------+-------------------------+-------------------------+--------+--------+
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |⋄⋄⋄⋄⋄⋄⋄⋄|⋄⋄⋄⋄⋄⋄⋄⋄|
|*       |                         |                         |        |        |
|00000310| 10 00 00 00 00 00 00 00 | 52 e5 74 64 04 00 00 00 |•⋄⋄⋄⋄⋄⋄⋄|R×td•⋄⋄⋄|
+--------+-------------------------+-------------------------+--------+--------+

Misaligned:

> hexyl -o 0x100000000 -s 0x2f0 -n 0x30 $(which hexyl)
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│01000002f0│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│*       │                         ┊                         │        ┊        │
│0100000310│ 10 00 00 00 00 00 00 00 ┊ 52 e5 74 64 04 00 00 00 │•⋄⋄⋄⋄⋄⋄⋄┊R×td•⋄⋄⋄│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
> hexyl -o 0x100000000 -s 0x2f0 -n 0x30 $(which hexyl) --border=ascii
+--------+-------------------------+-------------------------+--------+--------+
|01000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |⋄⋄⋄⋄⋄⋄⋄⋄|⋄⋄⋄⋄⋄⋄⋄⋄|
|*       |                         |                         |        |        |
|0100000310| 10 00 00 00 00 00 00 00 | 52 e5 74 64 04 00 00 00 |•⋄⋄⋄⋄⋄⋄⋄|R×td•⋄⋄⋄|
+--------+-------------------------+-------------------------+--------+--------+

Note just the 8 characters of dashes/spaces in the first column, instead of 10.

Additionally, if you have a dump crossing the threshold, even with no borders or squeezing the alignment still gets thrown out.

> hexyl -o 0xFFFFFD00 -s 0x2f0 -n 0x30 $(which hexyl) --border=none
 fffffff0  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ⋄⋄⋄⋄⋄⋄⋄⋄ ⋄⋄⋄⋄⋄⋄⋄⋄ 
 *                                                                              
 0100000010  10 00 00 00 00 00 00 00   52 e5 74 64 04 00 00 00  •⋄⋄⋄⋄⋄⋄⋄ R×td•⋄⋄⋄ 
> hexyl -o 0xFFFFFD00 -s 0x2f0 -n 0x30 $(which hexyl) --border=none -v
 fffffff0  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ⋄⋄⋄⋄⋄⋄⋄⋄ ⋄⋄⋄⋄⋄⋄⋄⋄ 
 0100000000  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ⋄⋄⋄⋄⋄⋄⋄⋄ ⋄⋄⋄⋄⋄⋄⋄⋄ 
 0100000010  10 00 00 00 00 00 00 00   52 e5 74 64 04 00 00 00  •⋄⋄⋄⋄⋄⋄⋄ R×td•⋄⋄⋄ 

apple1417 avatar Sep 21 '24 03:09 apple1417