diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-04-30 15:21:00 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-04-30 22:22:59 +0000 |
commit | 9fba5f0764678cfed4b7ff2a41fdcb0babcdbf55 (patch) | |
tree | 0515e84e39049ba809ab2c1e8c1be4e6964a464a /epan/dissectors/packet-netperfmeter.c | |
parent | d2b02eaf591145f40eaa65d6b50908e47d7c4484 (diff) |
Fix some cases where we're shifting a signed 1 left.
Shift 1U instead, to make sure it's unsigned; the result of, for
example, the result of shifting a signed value left is undefined if the
value times 2^{shift count} doesn't fit in the *signed* type of the
shifted value. That means, in particular, that the result of shifting 1
left by {number of bits in an int - 1} is undefined. (In *practice*,
it'll probably be -2^32, with the bit you want set, but that's not
guaranteed, and GCC 5.1 seems not to like it.)
Change-Id: I0d27565c382a04ceda9eec65f45a430ceb74cf53
Reviewed-on: https://code.wireshark.org/review/8255
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-netperfmeter.c')
-rw-r--r-- | epan/dissectors/packet-netperfmeter.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dissectors/packet-netperfmeter.c b/epan/dissectors/packet-netperfmeter.c index 698608600a..8c77f25c39 100644 --- a/epan/dissectors/packet-netperfmeter.c +++ b/epan/dissectors/packet-netperfmeter.c @@ -281,8 +281,8 @@ dissect_npmp_add_flow_message(tvbuff_t *message_tvb, proto_tree *message_tree) retranstrials = tvb_get_ntohl(message_tvb, offset_addflow_retranstrials); proto_tree_add_uint_format_value(message_tree, hf_addflow_retranstrials, message_tvb, offset_addflow_retranstrials, length_addflow_retranstrials, - retranstrials, (retranstrials & (1 << 31)) ? "%u ms" : "%u trials", - retranstrials &~ (1 << 31)); + retranstrials, (retranstrials & (1U << 31)) ? "%u ms" : "%u trials", + retranstrials &~ (1U << 31)); ADD_FIELD_UINT(message_tree, addflow_frameraterng); ADD_FIELD_UINT(message_tree, addflow_framerate1); |