ber: fix undefined shift

Fixes this UBSan warning:

    epan/dissectors/packet-ber.c:1917:23: runtime error: left shift of
        54645397829836991 by 8 places cannot be represented in type
        'long int'

Integers are two's complement, so really just cast it to unsigned to
avoid undefined behavior and still set the upper bit.

Change-Id: Ia5d080ae8b9dd39aef5e700daeede5c235b425ea
Reviewed-on: https://code.wireshark.org/review/8908
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2015-06-12 19:54:43 +02:00
parent 8e746bdd20
commit eaf702bdcc
1 changed files with 1 additions and 1 deletions

View File

@ -1914,7 +1914,7 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im
}
}
for (i=0; i<len; i++) {
val = (val<<8) | tvb_get_guint8(tvb, offset);
val = ((guint64)val<<8) | tvb_get_guint8(tvb, offset);
offset++;
}
}