Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions broken when analyzing file opened with ihex:// #14439

Open
haystack-ia opened this issue Jun 27, 2019 · 2 comments
Open

functions broken when analyzing file opened with ihex:// #14439

haystack-ia opened this issue Jun 27, 2019 · 2 comments

Comments

@haystack-ia
Copy link
Contributor

haystack-ia commented Jun 27, 2019

This template is meant for bug reports, if you have a feature request, please be as descriptive as possible and delete the template

Make sure you are testing using the latest git version of radare2 before submitting any issue.

If you would like to report a bug, please fill the template below

Work environment

Questions Answers
OS/arch/bits (mandatory) Mac OS 10.14.5 x86_64
File format of the file you reverse (mandatory) intel hexdump of firmware blob
Architecture/bits of the file (mandatory) ARM Cortex-M3
r2 -v full output, not truncated (mandatory) radare2 3.7.0-git 22245 @ darwin-x86-64 git.3.6.0-14-g4a1392932
commit: 4a13929 build: 2019-06-27__13:02:04

Expected behavior

When I load ihex file (attached) via r2 ihex://example.hex, p=e should show the entropy of various blocks. p=i should show number of invalid commands per block. Dumping the contents of the hex file into binary (via s 0x8000000;wtf! example.bin) should produce a valid binary file that matches the contents of the .hex.

Actual behavior

I converted example.hex into binary using the 010 hex editor and p=i and p=e commands' output does not match output when ran on the hex file opened w/ ihex.

When attempting to dump contents of ihex as binary (via s 0x8000000;wtf! example.bin as above), it wrote the first 0x100 bytes over and over rather than reproducing the contents of the hex file.

Steps to reproduce the behavior

Hex file is here: hex_file.zip

Load into r2 and run p=e, p=i (with various archs), wtf! thing.bin @ 0x8000000 to see what I mean.

@radare
Copy link
Collaborator

radare commented Jun 27, 2019 via email

@haystack-ia
Copy link
Contributor Author

I don't think so. If I'm reading it right, the issues w/ #8512 stem from io.0xff settings, which only affects addresses that the .hex file doesn't define. The issue I'm running into concerns areas that the .hex file does define.

Definitely with the wtf! thing.bin @ 0x8000000 command I mentioned, the issue isn't that undefined areas are filled in with 0xff instead of 0. The issue is that it writes the same block (0x8000000->0x8000100) over and over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants