Fix x-axis address overflow in histogram (#6563)

This commit is contained in:
Farhan Saiyed 2026-07-23 11:06:28 -04:00 committed by GitHub
parent 3a22989501
commit 78045e8fc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 116 additions and 147 deletions

View file

@ -691,8 +691,14 @@ static void render_visual_xaxis_ruler(RzStrBuf *buf, const RzHistogramInteractiv
if (!tick_cols) {
return;
}
ut32 space;
if ((data_cols > (ut32)addr_w)) {
space = data_cols - addr_w;
} else {
space = 1;
}
for (int t = 0; t < ticks; t++) {
tick_cols[t] = (int)((ut64)t * (data_cols - 1) / (ticks - 1));
tick_cols[t] = (int)((ut64)t * space / (ticks - 1));
}
rz_strbuf_appendf(buf, "%*s", gutter_w, "");
next_tick = 0;

View file

@ -164,8 +164,8 @@ EXPECT=<<EOF
85│█
│█
0│▲██████████████████████████████████████████████████████████████████████████
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0x100
Index 0 data 0 0x0 0%[?25l  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 
255│ ▼
@ -175,45 +175,8 @@ Index 0 data 0 0x0 0%
85│ █
│ █
0│█████████████████████████████████████▲█████████████████████████████████████
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0
^ ^ ^ ^ ^ ^ ^ ^ ^
0x0 0x0 0x0 0x0 0x0 0x100 0x100 0x100 0x100
Index 1 data 0 0x100 100%[?25h END
EOF
RUN
NAME=data xrefs outside functions marked as data
FILE=bins/elf/analysis/mipsbe-ip
CMDS=<<EOF
e scr.utf8=false
e scr.color=0
aaa
s 0x4350f8
< q ; Vp
echo END
EOF
EXPECT=<<EOF
[?25l[0x004350f8 [xAdvc]0 90% 115 bins/elf/analysis/mipsbe-ip]> pd $r @ data.004350f8
; XREFS(69)
;-- data.004350f8:
0x004350f8 .dword 0x00430000
; DATA XREF from fcn.004020d0 @ 0x402108
;-- data.004350fc:
0x004350fc .dword 0x00435420 ; section..sdata
; DATA XREF from fcn.004020d0 @ 0x402120
;-- data.00435100:
0x00435100 .dword 0x0043396c ; obj.__DTOR_END
; XREFS(156)
;-- data.00435104:
0x00435104 .dword 0x00420000 ; str.ute_get_ADDRESS___from_ADDRE 
; DATA XREF from sym._init @ 0x402024
; DATA XREF from sym._fini @ 0x41ecd0
;-- data.00435108:
0x00435108 .dword 0x00400000 ; segment.LOAD0 ; segment.ehdr
0x0043510c .dword 0x00000000
0x00435110 .dword 0x00000000
0x00435114 .dword 0x00000000
0x00435118 .dword 0x00000000
; DATA XREF from fcn.00414700 @ +0xbb0
; DATA XREF from sym.rtnl_open_byproto @ 0x41a878 0.0%[?25h END
EOF
RUN