Plug segfault on NULL pointer dereference in debugedit (RhBug:929365)
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 22 May 2013 04:24:06 +0000 (07:24 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 7 Jun 2013 09:26:31 +0000 (12:26 +0300)
- Not sure what the right thing to do would be here, ignoring seems
  like a better option than crashing though...
(cherry picked from commit ea47e7a8169187f87a70ff0c1059e99b0d09e659)

tools/debugedit.c

index f48d6f7..a658d5b 100644 (file)
@@ -484,6 +484,10 @@ edit_dwarf2_line (DSO *dso, uint32_t off, char *comp_dir, int phase)
   if (phase != 0)
     return 0;
 
+  /* XXX: RhBug:929365, should we error out instead of ignoring? */
+  if (ptr == NULL)
+    return 0;
+
   ptr += off;
 
   endcu = ptr + 4;