Module: kamailio
Branch: 5.5
Commit: 3e82cdbf2311deedb0a3cb528047b54e11d54808
URL:
https://github.com/kamailio/kamailio/commit/3e82cdbf2311deedb0a3cb528047b54…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-11-05T08:44:26+01:00
core: hashes - cast to unsigned int for left shifting
(cherry picked from commit f7f9ea0f3cfb8e61a4f2f47a214cb4e89d713da4)
---
Modified: src/core/hashes.h
---
Diff:
https://github.com/kamailio/kamailio/commit/3e82cdbf2311deedb0a3cb528047b54…
Patch:
https://github.com/kamailio/kamailio/commit/3e82cdbf2311deedb0a3cb528047b54…
---
diff --git a/src/core/hashes.h b/src/core/hashes.h
index 2afb8361c8..62708bdb35 100644
--- a/src/core/hashes.h
+++ b/src/core/hashes.h
@@ -273,7 +273,7 @@ static inline unsigned int core_hash(const str *s1, const str *s2,
end=s1->s+s1->len;
for ( p=s1->s ; p<=(end-4) ; p+=4 ){
- v=(*p<<24)+(p[1]<<16)+(p[2]<<8)+p[3];
+ v=((unsigned int)p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3];
ch_h_inc;
}
v=0;
@@ -283,11 +283,11 @@ static inline unsigned int core_hash(const str *s1, const str *s2,
if (s2) {
end=s2->s+s2->len;
for (p=s2->s; p<=(end-4); p+=4){
- v=(*p<<24)+(p[1]<<16)+(p[2]<<8)+p[3];
+ v=((unsigned int)p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3];
ch_h_inc;
}
v=0;
- for (; p<end ; p++){ v<<=8; v+=*p;}
+ for (; p<end ; p++){ v<<=8; v+=p[0];}
ch_h_inc;
}
h=((h)+(h>>11))+((h>>13)+(h>>23));