[PATCH] libosmocore[master]: gprs_cipher_core: Use typecase to avoid sanitizer error

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 4 10:25:49 UTC 2017


Review at  https://gerrit.osmocom.org/1530

gprs_cipher_core: Use typecase to avoid sanitizer error

This resolves
gprs_cipher_core.c:118:37: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Change-Id: Ib1866595030ad9d11c886621ce69632462befa3a
---
M src/gsm/gprs_cipher_core.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/30/1530/1

diff --git a/src/gsm/gprs_cipher_core.c b/src/gsm/gprs_cipher_core.c
index 8f020b3..da6e0a8 100644
--- a/src/gsm/gprs_cipher_core.c
+++ b/src/gsm/gprs_cipher_core.c
@@ -115,7 +115,7 @@
 /* GSM TS 04.64 / Section A.2.1 : Generation of 'input' */
 uint32_t gprs_cipher_gen_input_ui(uint32_t iov_ui, uint8_t sapi, uint32_t lfn, uint32_t oc)
 {
-	uint32_t sx = ((1<<27) * sapi) + (1<<31);
+	uint32_t sx = ((1<<27) * sapi) + ((uint32_t ) 1<<31);
 
 	return (iov_ui ^ sx) + lfn + oc;
 }

-- 
To view, visit https://gerrit.osmocom.org/1530
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1866595030ad9d11c886621ce69632462befa3a
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list