From e9794d528b8066b732661f5a009832cb04aa4453 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 14 Dec 2007 00:42:11 +0000 Subject: [PATCH] assert some bounds values that should never be out of bounds (or the arrays would be out of bounds anyways) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6778 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_bitpack.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/include/switch_bitpack.h b/src/include/switch_bitpack.h index 5f07a1f050..670f26e45c 100644 --- a/src/include/switch_bitpack.h +++ b/src/include/switch_bitpack.h @@ -99,12 +99,17 @@ static inline void pack_check_over(switch_bitpack_t *pack) 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;