+2020-03-23 Nick Clifton <nickc@redhat.com>
+
+ PR 25714
+ * wrstabs.c (stab_pop_type): Replace assertion with error return.
+ * write_stabs_in_sections_debugging_info: Likewise.
+ * stab_enum_type: Likewise.
+ * stab_modify_type: Likewise.
+ * stab_struct_field: Likewise.
+ * stab_end_struct_type: Likewise.
+ * stab_start_class_type: Likewise.
+ * stab_class_static_member: Likewise.
+ * stab_class_baseclass: Likewise.
+ * stab_class_start_method: Likewise.
+ * stab_class_method_var: Likewise.
+ * stab_class_end_method: Likewise.
+ * stab_end_class_type: Likewise.
+ * stab_typedef_type: Likewise.
+ * stab_start_function: Likewise.
+ * stab_end_block: Likewise.
+ * stab_lineno: Likewise.
+
2020-03-20 Nick Clifton <nickc@redhat.com>
* readelf.c (get_compression_header): Add ATTRIBUTE_WARN_UNUSED_RESULT.
char *ret;
s = info->type_stack;
- assert (s != NULL);
+ if (s == NULL)
+ return NULL;
info->type_stack = s->next;
if (! debug_write (dhandle, &stab_fns, (void *) &info))
return FALSE;
- assert (info.pending_lbrac == (bfd_vma) -1);
+ if (info.pending_lbrac != (bfd_vma) -1)
+ return FALSE;
/* Output a trailing N_SO. */
if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
if (names == NULL)
{
- assert (tag != NULL);
+ if (tag == NULL)
+ return FALSE;
buf = (char *) xmalloc (10 + strlen (tag));
sprintf (buf, "xe%s:", tag);
long tindex;
char *s, *buf;
- assert (info->type_stack != NULL);
+ if (info->type_stack == NULL)
+ return FALSE;
targindex = info->type_stack->index;
if (targindex <= 0
/* Add this field to the end of the current struct fields, which is
currently on the top of the stack. */
+ if (info->type_stack->fields == NULL)
+ return FALSE;
- assert (info->type_stack->fields != NULL);
n = (char *) xmalloc (strlen (info->type_stack->fields)
+ strlen (name)
+ strlen (s)
unsigned int size;
char *fields, *first, *buf;
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL || info->type_stack->fields == NULL)
+ return FALSE;
definition = info->type_stack->definition;
tindex = info->type_stack->index;
if (ownvptr)
{
- assert (info->type_stack->index > 0);
+ if (info->type_stack->index < 1)
+ return FALSE;
vtable = (char *) xmalloc (20);
sprintf (vtable, "~%%%ld", info->type_stack->index);
}
else
{
- assert (vstring);
+ if (vstring == NULL)
+ return FALSE;
vtable = (char *) xmalloc (strlen (vstring) + 3);
sprintf (vtable, "~%%%s", vstring);
free (vstring);
/* Add this field to the end of the current struct fields, which is
currently on the top of the stack. */
- assert (info->type_stack->fields != NULL);
+ if (info->type_stack->fields == NULL)
+ return FALSE;
n = (char *) xmalloc (strlen (info->type_stack->fields)
+ strlen (name)
+ strlen (s)
/* Add the new baseclass to the existing ones. */
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL || info->type_stack->fields == NULL)
+ return FALSE;
if (info->type_stack->baseclasses == NULL)
c = 0;
struct stab_write_handle *info = (struct stab_write_handle *) p;
char *m;
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL || info->type_stack->fields == NULL)
+ return FALSE;
if (info->type_stack->methods == NULL)
{
context = stab_pop_type (info);
}
- assert (info->type_stack != NULL && info->type_stack->methods != NULL);
+ if (info->type_stack == NULL || info->type_stack->methods == NULL)
+ return FALSE;
switch (visibility)
{
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- assert (info->type_stack != NULL && info->type_stack->methods != NULL);
+ if (info->type_stack == NULL || info->type_stack->methods == NULL)
+ return FALSE;
/* We allocated enough room on info->type_stack->methods to add the
trailing semicolon. */
unsigned int i = 0;
char *buf;
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL
+ || info->type_stack->string == NULL
+ || info->type_stack->fields == NULL)
+ return FALSE;
/* Work out the size we need to allocate for the class definition. */
struct string_hash_entry *h;
h = string_hash_lookup (&info->typedef_hash, name, FALSE, FALSE);
- assert (h != NULL && h->index > 0);
+ if (h == NULL || h->index < 1)
+ return FALSE;
return stab_push_defined_type (info, h->index, h->size);
}
struct stab_write_handle *info = (struct stab_write_handle *) p;
char *rettype, *buf;
- assert (info->nesting == 0 && info->fun_offset == -1);
+ if (info->nesting != 0 || info->fun_offset != -1)
+ return FALSE;
rettype = stab_pop_type (info);
info->pending_lbrac = (bfd_vma) -1;
}
- assert (info->nesting > 0);
+ if (info->nesting < 1)
+ return FALSE;
--info->nesting;
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- assert (info->lineno_filename != NULL);
+ if (info->lineno_filename == NULL)
+ return FALSE;
if (addr > info->last_text_address)
info->last_text_address = addr;