Author: mikej Date: Thu Dec 13 19:42:11 2007 New Revision: 6778 Modified: freeswitch/trunk/src/include/switch_bitpack.h Log: assert some bounds values that should never be out of bounds (or the arrays would be out of bounds anyways) Modified: freeswitch/trunk/src/include/switch_bitpack.h ============================================================================== --- freeswitch/trunk/src/include/switch_bitpack.h (original) +++ freeswitch/trunk/src/include/switch_bitpack.h Thu Dec 13 19:42:11 2007 @@ -99,12 +99,17 @@ pack->bits_cur = pack->over; if (pack->mode == SWITCH_BITPACK_MODE_RFC3551) { + while (pack->over > 8) { + pack->over -= 8; + } + if (pack->over > 8) return; this_byte &= SWITCH_BITPACKED_MASKS[pack->over]; this_byte <<= pack->under; *pack->cur |= this_byte; pack->cur++; } else { switch_byte_t mask = SWITCH_BITS_PER_BYTE - pack->over; + switch_assert(mask < 8); /* if pack->over this will allways be true */ this_byte &= SWITCH_REVERSE_BITPACKED_MASKS[mask]; this_byte >>= mask;
participants (1)
-
Freeswitch SVN