redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.82k stars 128 forks source link

Add support for multiple comments on the same Range #458

Open Ivanov1ch opened 2 months ago

Ivanov1ch commented 2 months ago

What is the use case for the feature? Making multiple comments without specifying a range - eg custom unpackers automatically adding comments with file metadata to be displayed in the GUI. Does the feature contain any proprietary information about another company's intellectual property? No How would you implement this feature? Refactor CommentsAttributes.comments to from the current comments: Dict[Optional[Range], str] to comments: Dict[Optional[Range], List[str]]. Keeping the Dict would mean less changes to the existing codebase and quicker lookup times for specific comments at scale when compared to another approach like a List of comments. Are there any (reasonable) alternative approaches? The current approach handles the creation of a new comment on the same range as an existing comment by appending a newline. This combines the comments into one larger comment, which both messes up the # Comment formatting on the GUI and means that it is impossible to delete one comment without deleting both, making it a bad alternative. Are you interested in implementing it yourself? Yes. PR incoming