aboutsummaryrefslogtreecommitdiff
path: root/src/target/image.c
diff options
context:
space:
mode:
authorCody Schafer <openocd@codyps.com>2018-07-02 15:56:53 -0400
committerTomas Vanek <vanekt@fbl.cz>2018-07-13 17:15:57 +0100
commit4a9a07b1c5189e8f9024fa843f511a0e948e61b5 (patch)
treee4c13d656f75ad3b61fe5c9acc639a7f729a8f90 /src/target/image.c
parent73de82898840292b000ded9a48031701961c3c83 (diff)
target/image: make i/j unsigned to avoid ubsan runtime error
src/target/image.c:1055:15: runtime error: left shift of 128 by 24 places cannot be represented in type 'int' Change-Id: I322fd391cf3f242beffc8a274824763c8c5e69a4 Signed-off-by: Cody Schafer <openocd@codyps.com> Reviewed-on: http://openocd.zylin.com/4584 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Christopher Head <chead@zaber.com>
Diffstat (limited to 'src/target/image.c')
-rw-r--r--src/target/image.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/target/image.c b/src/target/image.c
index 9f56bea0..0d98c57b 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -1048,8 +1048,7 @@ int image_calculate_checksum(uint8_t *buffer, uint32_t nbytes, uint32_t *checksu
static bool first_init;
if (!first_init) {
/* Initialize the CRC table and the decoding table. */
- int i, j;
- unsigned int c;
+ unsigned int i, j, c;
for (i = 0; i < 256; i++) {
/* as per gdb */
for (c = i << 24, j = 8; j > 0; --j)