[sr-dev] git:master:0cb33abe: core: mem/f_malloc - explicit set to 0 for bit shifting greater than size
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jul 27 09:16:05 CEST 2017
Module: kamailio
Branch: master
Commit: 0cb33abe8b2196fb26baf459f66d9d7b9e920013
URL: https://github.com/kamailio/kamailio/commit/0cb33abe8b2196fb26baf459f66d9d7b9e920013
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-27T09:07:09+02:00
core: mem/f_malloc - explicit set to 0 for bit shifting greater than size
---
Modified: src/core/mem/f_malloc.c
---
Diff: https://github.com/kamailio/kamailio/commit/0cb33abe8b2196fb26baf459f66d9d7b9e920013.diff
Patch: https://github.com/kamailio/kamailio/commit/0cb33abe8b2196fb26baf459f66d9d7b9e920013.patch
---
diff --git a/src/core/mem/f_malloc.c b/src/core/mem/f_malloc.c
index 89985a4c72..184037814e 100644
--- a/src/core/mem/f_malloc.c
+++ b/src/core/mem/f_malloc.c
@@ -122,7 +122,8 @@ inline static int fm_bmp_first_set(struct fm_block* qm, int start)
return (start-bit+r);
}
#endif
- v=qm->free_bitmap[bmp_idx]>>(bit+1);
+ if((bit+1) < 8*sizeof(v)) v=qm->free_bitmap[bmp_idx]>>(bit+1);
+ else v = 0;
return start+1+bit_scan_forward((unsigned long)v);
}
for (r=bmp_idx+1;r<FM_HASH_BMP_SIZE; r++){
More information about the sr-dev
mailing list