This is an automated email from Gerrit.

Cody Schafer (open...@codyps.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/4455

-- gerrit

commit 908f8381ef56edc1bb970e35d92b81033d532696
Author: Cody P Schafer <open...@codyps.com>
Date:   Wed Mar 7 11:27:02 2018 -0500

    helper/types: cast to uint32_t to avoid UB by shifting int too far
    
    Change-Id: I24f6abfd26b6980100657397d69c84f2b80a005a
    Signed-off-by: Cody P Schafer <open...@codyps.com>

diff --git a/src/helper/types.h b/src/helper/types.h
index 58c9e72..e3a7182 100644
--- a/src/helper/types.h
+++ b/src/helper/types.h
@@ -123,7 +123,7 @@ static inline uint64_t le_to_h_u64(const uint8_t *buf)
 
 static inline uint32_t le_to_h_u32(const uint8_t* buf)
 {
-       return (uint32_t)(buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24);
+       return (uint32_t)((uint32_t)buf[0] | (uint32_t)buf[1] << 8 | 
(uint32_t)buf[2] << 16 | (uint32_t)buf[3] << 24);
 }
 
 static inline uint32_t le_to_h_u24(const uint8_t* buf)

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to