Check if mask_greatest_bit_offset is within limits.

The result of the '>>' expression is undefined if mask_greatest_bit_offset = 0.

Change-Id: I15b094a5220a5075878bad65ab0b8c5279e80e8a
Reviewed-on: https://code.wireshark.org/review/4723
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Stig Bjørlykke 2014-10-16 14:04:57 +02:00 committed by Michael Mann
parent 4963d99c4a
commit 39c3a794d8
1 changed files with 1 additions and 1 deletions

View File

@ -7862,7 +7862,7 @@ proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hfindex, tvbu
/* As noted above, we currently only produce a bitmap if the crumbs span less than 4 octets of the tvb.
It would be a useful enhancement to eliminate this restriction. */
if (mask_greatest_bit_offset <= 32) {
if (mask_greatest_bit_offset > 0 && mask_greatest_bit_offset <= 32) {
other_decode_bitfield_value(bf_str,
(guint32)(composite_bitmap >> (64 - mask_greatest_bit_offset)),
(guint32)(composite_bitmask >> (64 - mask_greatest_bit_offset)),