Fix pxj output (#3290)

This commit is contained in:
Giovanni 2023-01-14 14:14:34 +08:00 committed by GitHub
parent 48ece26787
commit 4a9740d11d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -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);
}

View file

@ -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