diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-04-30 20:03:39 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-05-01 06:50:36 +0000 |
commit | b84972635117aa5cac7f8e6296d07ceb51bfe5e2 (patch) | |
tree | 89f3c0baff68f63dcadb737de9e4da3c2b97bdfc /epan/dissectors/packet-ess.c | |
parent | 91515a008143901473e018033a76933abfec3c1f (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.)
Make some other left-hand operands of <<, and some variables holding
results from shifts of that sort, unsigned, while we're at it.
Change-Id: Ie72a9d0d518f59b35948267d10c80735d162e8bb
Reviewed-on: https://code.wireshark.org/review/8264
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-ess.c')
-rw-r--r-- | epan/dissectors/packet-ess.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-ess.c b/epan/dissectors/packet-ess.c index 4eb663c3b5..c5aee8ed7d 100644 --- a/epan/dissectors/packet-ess.c +++ b/epan/dissectors/packet-ess.c @@ -267,7 +267,7 @@ ess_dissect_attribute_flags (tvbuff_t *tvb, asn1_ctx_t *actx) if ((strcmp (u->oid, object_identifier_id) == 0) && ((u->lacv / 8) < tvb_captured_length (tvb)) && - (value[u->lacv / 8] & (1 << (7 - (u->lacv % 8))))) + (value[u->lacv / 8] & (1U << (7 - (u->lacv % 8))))) { proto_tree_add_string_format (tree, hf_ess_Category_attribute, tvb, u->lacv / 8, 1, u->name, |