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

Writes with pf do nothing #18308

Closed
Hi-Angel opened this issue Jan 29, 2021 · 4 comments
Closed

Writes with pf do nothing #18308

Hi-Angel opened this issue Jan 29, 2021 · 4 comments
Assignees
Milestone

Comments

@Hi-Angel
Copy link
Contributor

Environment

Пт 29 янв 2021 09:22:46 MSK
radare2 5.0.0 0 @ linux-x86-64 git.5.0.0
commit: unknown build: 2021-01-21__00:15:48
Linux x86_64

Description

When a value is overwritten with pf command (for example pf.foo=7), the command silently exits as if it succeeded in writing, but displaying the "overwritten" field shows older values. This came up yesterday on IRC, and apparently is a bug.

Test

You'll need some PE executable, in the testcase I'm using an arbitrary one distributed in WINE project.

 $ cp /usr/lib32/wine/notepad.exe .
 $ r2 -nnw notepad.exe
 -- radare2 is power, France is pancake.
[0x00000000]> pf.pe_image_file_header.characteristics
      characteristics : 0x00000012 = characteristics (bitfield) = 0x00000000 :
[0x00000000]> pf.pe_image_file_header.characteristics=7
[0x00000000]> pf.pe_image_file_header.characteristics
      characteristics : 0x00000012 = characteristics (bitfield) = 0x00000000 :
[0x00000000]>

Expected

The last command will show characteristics field has new value 7

Actual

The last command shows characteristics field has older value 0

@Hi-Angel
Copy link
Contributor Author

So, I wanted to bisect it. First, I tried out master, commit 590eaa6 from yesterday. Still same problem. Then I checked out branch/tag 3.1.2 from 2018, built it, an tried that out.Well, it didn't work either, so I suspect it have never worked.

@Hi-Angel
Copy link
Contributor Author

FTR: after discussion in Telegram it turned out that assignment with pf sometimes works, sometimes doesn't. In particular, this example was given where I confirm that it works:

image

@Hi-Angel
Copy link
Contributor Author

Hi-Angel commented Feb 7, 2021

Okay, just so this info won't get lost: a week ago Anymy user in chat did some research on this problem, and found, quoting:

i found... problem in bitfield. bitfield and enums don't implemented write functional. You can write in other types, but not in bitfields

Also strings (not zero terminated)

@trufae
Copy link
Collaborator

trufae commented Feb 7, 2021

Theres a warning now, but it should be easy to implement the write case for those types. Any volunteer? :)

@trufae trufae modified the milestones: 5.3.0, 5.2.1 Apr 12, 2021
@trufae trufae self-assigned this Apr 16, 2021
@trufae trufae modified the milestones: 5.2.1, 5.3.0 Apr 21, 2021
trufae pushed a commit that referenced this issue May 27, 2021
@trufae trufae closed this as completed in 6181e1e May 27, 2021
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

No branches or pull requests

2 participants