summaryrefslogtreecommitdiff
path: root/bfd/versados.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/versados.c')
-rw-r--r--bfd/versados.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/bfd/versados.c b/bfd/versados.c
index 42bf36c9cd8..5bafcb1d7cd 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -430,7 +430,8 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
else
{
need_contents = 1;
- if (dst_idx < esdid->section->size)
+
+ if (esdid->section && dst_idx < esdid->section->size)
if (pass == 2)
{
/* Absolute code, comes in 16 bit lumps. */
@@ -445,8 +446,15 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
if (!contents && need_contents)
{
- bfd_size_type size = esdid->section->size;
- esdid->contents = bfd_alloc (abfd, size);
+ if (esdid->section)
+ {
+ bfd_size_type size;
+
+ size = esdid->section->size;
+ esdid->contents = bfd_alloc (abfd, size);
+ }
+ else
+ esdid->contents = NULL;
}
}
@@ -585,6 +593,13 @@ versados_object_p (bfd *abfd)
return NULL;
}
+ /* PR 17512: file: 726-2128-0.004. */
+ if (len < 13)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
if (bfd_bread (&ext.type, (bfd_size_type) len, abfd) != len)
{
if (bfd_get_error () != bfd_error_system_call)