Skip to content

Commit

Permalink
ositp: fix undefined behavior from large shift
Browse files Browse the repository at this point in the history
Display "2^105" instead of the expanded value.

Change-Id: I455625ab66cd86587ca35d09e1eba98ae1d87a94
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1149
Bug: 13606
Reviewed-on: https://code.wireshark.org/review/21188
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
  • Loading branch information
Lekensteyn authored and mmann78 committed Apr 18, 2017
1 parent 67d7a94 commit 5df6cc4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions epan/dissectors/packet-ositp.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,19 +536,17 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,

case VP_RES_ERROR:
s = tvb_get_guint8(tvb, offset);
proto_tree_add_uint_format(tree, hf_cotp_res_error_rate_target_value, tvb, offset, 1,
s, "Residual error rate, target value: 10^%u", s);
proto_tree_add_uint_format_value(tree, hf_cotp_res_error_rate_target_value, tvb, offset, 1, s, "10^%u", s);
offset += 1;
vp_length -= 1;

s = tvb_get_guint8(tvb, offset);
proto_tree_add_uint_format(tree, hf_cotp_res_error_rate_min_accept, tvb, offset, 1,
s, "Residual error rate, minimum acceptable: 10^%u", s);
proto_tree_add_uint_format_value(tree, hf_cotp_res_error_rate_min_accept, tvb, offset, 1, s, "10^%u", s);
offset += 1;
vp_length -= 1;

s = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(tree,hf_cotp_res_error_rate_tdsu, tvb, offset, 1, 1 << s);
proto_tree_add_uint_format_value(tree, hf_cotp_res_error_rate_tdsu, tvb, offset, 1, s, "2^%u", s);
offset += 1;
vp_length -= 1;
break;
Expand Down

0 comments on commit 5df6cc4

Please sign in to comment.