disas/i386: Avoid NULL pointer dereference in error case
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 3 Mar 2017 15:50:29 +0000 (15:50 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 7 Mar 2017 14:33:51 +0000 (14:33 +0000)
In a code path where we hit an internal disassembler error, execution
would subsequently attempt to dereference a NULL pointer.  This
should never happen, but avoid the crash.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1488556233-31246-3-git-send-email-peter.maydell@linaro.org

disas/i386.c

index 07f871fd642855e0abd8122a3c34e9a7bd43c8f1..f1e376ca4a8ae28ec28f833b27dd5db433bafcf6 100644 (file)
@@ -4043,7 +4043,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
            }
        }
 
-      if (putop (dp->name, sizeflag) == 0)
+      if (dp->name != NULL && putop (dp->name, sizeflag) == 0)
         {
          for (i = 0; i < MAX_OPERANDS; ++i)
            {