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 /asn1/rrc | |
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 'asn1/rrc')
-rw-r--r-- | asn1/rrc/rrc.cnf | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/asn1/rrc/rrc.cnf b/asn1/rrc/rrc.cnf index 35059a634b..bf164f486e 100644 --- a/asn1/rrc/rrc.cnf +++ b/asn1/rrc/rrc.cnf @@ -737,8 +737,8 @@ HNBName TYPE=FT_STRING DISPLAY=STR_UNICODE /*Here we try to figure out which HS-DSCH channels are multiplexed*/ #.FN_BODY DL-TransportChannelType-r5 VAL_PTR = &type - gint *flowd_p; - gint *cur_val=NULL; + guint *flowd_p; + guint *cur_val=NULL; struct rrc_info *rrcinf; %(DEFAULT_BODY)s @@ -757,11 +757,11 @@ HNBName TYPE=FT_STRING DISPLAY=STR_UNICODE if( (cur_val=(gint *)g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){ flowd_p = (guint*)g_malloc0(sizeof(gint)); - *flowd_p = (1<<flowd); /*Set the bit to mark it as true*/ + *flowd_p = (1U<<flowd); /*Set the bit to mark it as true*/ g_tree_insert(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]), flowd_p); }else{ - *cur_val = (1<<flowd) | *cur_val; + *cur_val = (1U<<flowd) | *cur_val; } } @@ -772,8 +772,8 @@ HNBName TYPE=FT_STRING DISPLAY=STR_UNICODE /*Here we try to figure out which HS-DSCH channels are multiplexed*/ #.FN_BODY DL-TransportChannelType-r7 VAL_PTR = &type - gint *flowd_p; - gint *cur_val=NULL; + guint *flowd_p; + guint *cur_val=NULL; struct rrc_info *rrcinf; %(DEFAULT_BODY)s @@ -793,11 +793,11 @@ HNBName TYPE=FT_STRING DISPLAY=STR_UNICODE if( (cur_val=(gint *)g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){ flowd_p = (guint*)g_malloc0(sizeof(gint)); - *flowd_p = (1<<flowd); /* Set the bit to mark it as true*/ + *flowd_p = (1U<<flowd); /* Set the bit to mark it as true*/ g_tree_insert(hsdsch_muxed_flows, GUINT_TO_POINTER((guint)rrcinf->hrnti[actx->pinfo->fd->subnum]), flowd_p); }else{ - *cur_val = (1<<flowd) | *cur_val; + *cur_val = (1U<<flowd) | *cur_val; } } |