+2020-01-14 Alan Modra <amodra@gmail.com>
+
+ * vms.h (VMS_DEBUG): Define as 0.
+ * vms-alpha.c (image_write): Move debug output after bounds check.
+ Tidy bounds check.
+ (_bfd_vms_slurp_eihd): Warning fix.
+ (_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
+
2020-01-13 Alan Modra <amodra@gmail.com>
* vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
vms_debug2 ((4, "EIHD size %d imgtype %d symvva 0x%lx eisd %d eihs %d\n",
size, imgtype, (unsigned long)symvva,
*eisd_offset, *eihs_offset));
+ (void) size;
return TRUE;
}
#if VMS_DEBUG
_bfd_vms_debug (8, "image_write from (%p, %d) to (%ld)\n", ptr, size,
(long)PRIV (image_offset));
- _bfd_hexdump (9, ptr, size, 0);
#endif
if (PRIV (image_section)->contents != NULL)
{
asection *sec = PRIV (image_section);
- file_ptr off = PRIV (image_offset);
+ size_t off = PRIV (image_offset);
/* Check bounds. */
- if (off > (file_ptr)sec->size
- || size > (file_ptr)sec->size
- || off + size > (file_ptr)sec->size)
+ if (off > sec->size
+ || size > sec->size - off)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
memcpy (sec->contents + off, ptr, size);
}
+#if VMS_DEBUG
+ _bfd_hexdump (9, ptr, size, 0);
+#endif
PRIV (image_offset) += size;
return TRUE;
unsigned char *ptr;
unsigned int length;
unsigned char *maxptr;
- bfd_vma op1;
- bfd_vma op2;
- unsigned int rel1;
- unsigned int rel2;
+ bfd_vma op1 = 0;
+ bfd_vma op2 = 0;
+ unsigned int rel1 = RELC_NONE;
+ unsigned int rel2 = RELC_NONE;
struct alpha_vms_link_hash_entry *h;
PRIV (recrd.rec) += ETIR__C_HEADER_SIZE;