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

small fixes in reset_architecture() #834

Closed
wants to merge 1 commit into from

Conversation

abgeana
Copy link

@abgeana abgeana commented May 19, 2022

small fixes in reset_architecture()

Description/Motivation/Screenshots

I ran into some issues while trying to use https://github.com/bet4it/udbserver.

The patch includes small bug fixes in reset_architecture(). The first is catching a RuntimeError if parsing the ELF header fails (in the case where the binary is not an ELF file), and the second one is arch_name.upper().

How Has This Been Tested?

Architecture Yes/No Comments
x86-32 ✖️
x86-64 ✖️
ARM ✔️
AARCH64 ✖️
MIPS ✖️
POWERPC ✖️
SPARC ✖️
RISC-V ✖️
make test ✖️

Checklist

  • My PR was done against the dev branch, not master.
  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • If my change adds new code, adequate tests have been added.
  • I have read and agree to the CONTRIBUTING document.

Copy link
Owner

@hugsy hugsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs re-work for merging safely, and/or strong justifications for the implementation choices.

@@ -3771,7 +3771,11 @@ def reset_architecture(arch: Optional[str] = None, default: Optional[str] = None
raise OSError(f"Specified arch {arch.upper()} is not supported")

if not gef.binary:
gef.binary = get_elf_headers()
try:
gef.binary = get_elf_headers()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a bad idea: gef.binary is literally used all the time and safe-failing that way (i.e. allowing gef.binary to be None) would open up plenty of error scenario where we assume it can't be.

What are the reasons behind this?

gef.py Show resolved Hide resolved
gef.py Show resolved Hide resolved
@abgeana
Copy link
Author

abgeana commented May 23, 2022

I am closing this pull request based on the gef targetting ELF files in particular and the fact that the code is still being refactored.

@abgeana abgeana closed this May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants