Skip to content

Commit

Permalink
Fix pxj output (#3290)
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio authored Jan 14, 2023
1 parent 48ece26 commit 4a9740d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion librz/util/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ RZ_API RZ_OWN char *rz_print_jsondump_str(RZ_NONNULL RzPrint *p, RZ_NONNULL cons
return NULL;
}
pj_a(j);
for (int i = 0; i + bytesize < len; i += bytesize) {
for (int i = 0; i + bytesize <= len; i += bytesize) {
ut64 word = rz_read_ble(buf + i, p->big_endian, wordsize);
pj_n(j, word);
}
Expand Down
19 changes: 19 additions & 0 deletions test/db/cmd/cmd_pd_bugs
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,22 @@ EXPECT=<<EOF
0x080484c8 55 push ebp
EOF
RUN

NAME=pxj 4 expects 4 bytes
FILE=malloc://128
CMDS=<<EOF
wx 9030405011223344
px 4
pxj 4
px 6 @ 2
pxj 6 @ 2
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 9030 4050 .0@P
[144,48,64,80]
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000002 4050 1122 3344 @P."3D
[64,80,17,34,51,68]
EOF
RUN

0 comments on commit 4a9740d

Please sign in to comment.