Skip to content

Inconsistent codeOffset parsing #14

@cpebble

Description

@cpebble

I encountered an inconsistency when working with E-T. When parsing negative code offsets, conditional jumps will happily accept this, however normal jumps throw a parser error.

Example:

; Valid
jgt r0, r11, +-5
; Invalid
ja +-5

This also leads to an issue in Ebpf.Display where displayProgram generates code it cannot parse:

>>> displayProgram [Jmp (-3)]
"ja +-3\n"
>>> parse "ja +-3\n"
Left "\"<input>\" (line 1, column 5):\nunexpected \"-\"\nexpecting \"0\" or digit"

You seem to have noticed this here: AsmParser.hs:139

IMO the easiest patch would be to include the required '+' in jmp parsing. This syntax is how Ken presented it in the Software Security course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions