Use gdbarch obstack to allocate the TYPE_NAME string in arch_type
[deliverable/binutils-gdb.git] / gdb / dtrace-probe.c
index ff7ce7d868f6259e0776f7f0b3decc8cf8a9fada..03b6264e7cb61089746b577d733ffe89bc4e1529 100644 (file)
@@ -386,8 +386,8 @@ dtrace_process_dof_probe (struct objfile *objfile,
     {
       uint32_t probe_offset
        = ((uint32_t *) offtab)[DOF_UINT (dof, probe->dofpr_offidx) + i];
-      struct dtrace_probe *ret
-       = obstack_alloc (&objfile->per_bfd->storage_obstack, sizeof (*ret));
+      struct dtrace_probe *ret =
+       XOBNEW (&objfile->per_bfd->storage_obstack, struct dtrace_probe);
 
       ret->p.pops = &dtrace_probe_ops;
       ret->p.arch = gdbarch;
@@ -413,7 +413,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
       for (j = 0; j < ret->probe_argc; j++)
        {
          struct dtrace_probe_arg arg;
-         struct expression *expr;
+         struct expression *expr = NULL;
 
          /* Set arg.expr to ensure all fields in expr are initialized and
             the compiler will not warn when arg is used.  */
@@ -519,6 +519,14 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
        unsigned int entsize = DOF_UINT (dof, probes_s->dofs_entsize);
        int num_probes;
 
+       if (DOF_UINT (dof, section->dofs_size)
+           < sizeof (struct dtrace_dof_provider))
+         {
+           /* The section is smaller than expected, so do not use it.
+              This has been observed on x86-solaris 10.  */
+           goto invalid_dof_data;
+         }
+
        /* Very, unlikely, but could crash gdb if not handled
           properly.  */
        if (entsize == 0)
This page took 0.02612 seconds and 4 git commands to generate.