radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
19.85k stars 2.95k forks source link

cmd_cmp does not honor endian #22933

Closed riptl closed 4 weeks ago

riptl commented 1 month ago

Environment

Mon May 13 02:48:40 PM UTC 2024
radare2 5.9.1 32253 @ linux-s390-64
birth: git.5.9.0-199-g1f8298bca5 2024-05-13__11:08:53
commit: 1f8298bca523e5a4c4f5058986c1b3148d8c42b4
options: gpl -O? cs:5 cl:2 make
Linux s390x

Description

c? behaves differently on big endian

Test

(Note that bins/elf/ls is LE)

[XX] /home/ripatel/radare2/test/db/cmd/cmd_c cmd_c4
R2_NOPLUGINS=1 radare2 -escr.utf8=0 -escr.color=0 -escr.interactive=0 -NN -Qc 'c4 0xfa1e0ff2
?e ---
c4* 0xfa1e0ff2
' bins/elf/ls
-- stdout
@@ -1,3 +1,9 @@
-0x00005ae0 (byte=01)   f3 ' '  ->  f2 ' '
+0x00005ae0 (byte=01)   f3 ' '  ->  fa ' '
+0x00005ae1 (byte=02)   0f ' '  ->  1e ' '
+0x00005ae2 (byte=03)   1e ' '  ->  0f ' '
+0x00005ae3 (byte=04)   fa ' '  ->  f2 ' '
 ---
-wx f2 @ 0x00005ae0
+wx fa @ 0x00005ae0
+wx 1e @ 0x00005ae1
+wx 0f @ 0x00005ae2
+wx f2 @ 0x00005ae3