refs #55: fix 2 NPEs

This commit is contained in:
bebbo 2019-01-15 20:50:47 +01:00
parent eaeca8737d
commit ac6f3ad417
3 changed files with 10 additions and 3 deletions

View File

@ -1 +1 @@
20190114085418
20190115204428

View File

@ -298,6 +298,9 @@ varpool_node::get_constructor (void)
struct lto_in_decl_state *decl_state
= lto_get_function_in_decl_state (file_data, decl);
if (!decl_state)
return NULL;
data = lto_get_section_data (file_data, LTO_section_function_body,
name, &len, decl_state->compressed);
if (!data)

View File

@ -115,8 +115,12 @@ readName (unsigned l, int descriptor, off_t * offset)
nameLen = l;
}
if (!l)
return 1;
{
if (!name)
name = XNEWVEC(unsigned char, 1);
*name = 0;
return 1;
}
int r = simple_object_internal_read (descriptor, *offset, name, l, &errmsg,
&err);
name[l] = 0;