You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
LIEF cannot insert a note into a binary which is not of a predefined format. When trying to create the note, I get the error:
Can't determine the raw type of note 'UNKNOWN' for the owner 'Custom'
Traceback (most recent call last):
File "/home/aeldidi/src/aeldidi/manifest/./tools/add_manifest.py", line 23, in <module>
binary.add(manifest)
TypeError: add(): incompatible function arguments. The following argument types are supported:
1. add(self, arg: lief._lief.ELF.DynamicEntry, /) -> lief._lief.ELF.DynamicEntry
2. add(self, section: lief._lief.ELF.Section, loaded: bool = True) -> lief._lief.ELF.Section
3. add(self, segment: lief._lief.ELF.Segment, base: int = 0) -> lief._lief.ELF.Segment
4. add(self, note: lief._lief.ELF.Note) -> lief._lief.ELF.Note
Invoked with types: lief._lief.ELF.Binary, NoneType
To Reproduce
import lief
import sys
binary = lief.ELF.parse(sys.argv[1])
note = lief.ELF.Note.create(
name="Custom",
type=lief.ELF.Note.TYPE.UNKNOWN,
description=list(
map(
ord,
"""
I passed through the seven levels of the Candy Cane forest,
through the sea of swirly twirly gum drops,
and then I walked through the Lincoln Tunnel.
""",
)
),
)
binary.add(note)
binary.write(sys.argv[1] + ".edited")
Expected behavior
A copy of the binary specified by sys.argv[1] now contains the custom note.
Environment (please complete the following information):
System and Version : Ubuntu 22.04.3
Target format ELF
LIEF commit version: 0.14.1-bae887e0
Additional context
I'm playing around with adding a custom note to an ELF file which would contain some metadata about the program and wanted to try injecting this note into existing ELF files to test it out. The metadata is currently just unstructured and the format isn't set in stone so I want to just add a note with arbitrary text data.
This capability seemed to be added in #301, but doesn't work currently.
Also, manually specifying the type as original_type=0 doesn't work either and gives this error:
Note type: 0x0 is not supported for owner: 'Custom'
Note type: UNKNOWN ('Custom') is not supported
NOTICE
If the issue does not contain enough information to be reproduced,
it will be flagged as incomplete
and closed.
/NOTICE
The text was updated successfully, but these errors were encountered:
Describe the bug
LIEF cannot insert a note into a binary which is not of a predefined format. When trying to create the note, I get the error:
To Reproduce
Expected behavior
A copy of the binary specified by
sys.argv[1]
now contains the custom note.Environment (please complete the following information):
Additional context
I'm playing around with adding a custom note to an ELF file which would contain some metadata about the program and wanted to try injecting this note into existing ELF files to test it out. The metadata is currently just unstructured and the format isn't set in stone so I want to just add a note with arbitrary text data.
This capability seemed to be added in #301, but doesn't work currently.
Also, manually specifying the type as
original_type=0
doesn't work either and gives this error:NOTICE
If the issue does not contain enough information to be reproduced,
it will be flagged as incomplete
and closed.
/NOTICE
The text was updated successfully, but these errors were encountered: