Module: kamailio Branch: master Commit: 0cb33abe8b2196fb26baf459f66d9d7b9e920013 URL: https://github.com/kamailio/kamailio/commit/0cb33abe8b2196fb26baf459f66d9d7b...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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/0cb33abe8b2196fb26baf459f66d9d7b... Patch: https://github.com/kamailio/kamailio/commit/0cb33abe8b2196fb26baf459f66d9d7b...
---
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++){