NeatMonster / AMIE

A Minimalist Instruction Extender for the ARM architecture and IDA Pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not correctly handling the case where "authored" is null in json

imlk0 opened this issue · comments

What happened?

Every time I move the mouse over a MUL Instruction(e.g. MUL X1, X1, X2), idapython prints this error message

Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_custom_viewer_hint'
Traceback (most recent call last):
  File "//xxxxx/ida-pro/plugins/amie.py", line 370, in get_custom_viewer_hint
    hint = self.arch.hint(place.toea(), tag, val)
  File "//xxxxx/ida-pro/plugins/amie.py", line 131, in hint
    desc += "\n\n" + "\n".join(insn["templates"][tmpl_name])
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

Possible reasons

By reading the source code, I think this is because the value of "authored" field of the MUL instruction in aarch64.json is null.

      "MUL_MADD": {
        "authored": null,
        "heading": "MUL",
        "templates": {
          "GENERAL": [
            "MUL  <Wd>, <Wn>, <Wm>",
            "MUL  <Xd>, <Xn>, <Xm>"
          ]
        }
      },

I don't know why "authored" is set to null, it might be a bug with the parser for generating aarch64.josn. But I think it would be good to add the handling of None type in amie.py