oss-fuzz: vms-alpha segfault in image_write_section

Yet another case where a fuzzed object file triggers a crash in the
vms-alpha support.

	* vms-alpha.c (image_write_section): Don't segfault on NULL
	image_section.
This commit is contained in:
Alan Modra 2026-06-13 10:27:22 +09:30
parent e0fe0e3abd
commit 95451ea43a

View file

@ -1603,7 +1603,8 @@ image_write_section (bfd *abfd)
{
asection *sec = PRIV (image_section);
if ((sec->flags & SEC_IN_MEMORY) != 0 && sec->contents == NULL)
if (sec == NULL
|| ((sec->flags & SEC_IN_MEMORY) != 0 && sec->contents == NULL))
return NULL;
return sec;
}