From b4e125d9351f84233698bef91530743547c87403 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 26 Aug 2020 11:26:35 +0930 Subject: [PATCH] PR26415 UBSAN: vms-misc.c:636 left shift cannot be represented An unsigned short value is promoted to int, thus triggering UB on a left shift of a positive value that results in a negative int. PR 26415 * vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars. --- bfd/ChangeLog | 5 +++++ bfd/vms-misc.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 616b22f1600..fe440e89c6b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-08-26 Alan Modra + + PR 26415 + * vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars. + 2020-08-26 David Faust * archures.c (bfd_mach_xbpf): Define. diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index d040c79de16..0826456ef0f 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -592,8 +592,8 @@ vms_time_to_time_t (unsigned int hi, unsigned int lo) void vms_time_t_to_vms_time (time_t ut, unsigned int *hi, unsigned int *lo) { - unsigned short val[4]; - unsigned short tmp[4]; + unsigned int val[4]; + unsigned int tmp[4]; unsigned int carry; int i; -- 2.30.2