diff options
author | Bill Meier <wmeier@newsguy.com> | 2015-02-07 22:44:10 -0500 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2015-02-08 03:52:03 +0000 |
commit | 14c37afb5d3bc96467528f6e9d710f131f451b03 (patch) | |
tree | 370256f63bf33d91651b4ff783691ec7b457ed0f /epan | |
parent | f494abdf6c6abd1388734a2e99d2f9e17c86152a (diff) |
dwarf: fix bug found by MSVC2013 Code Analysis
The following doesn't quite do what it might seem to be doing:
*value |= (byte & 0x7F) << shift; //guint64 *value // guint8 byte
The warning from MSVC2013:
Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit
value. Results might not be an expected value
Change-Id: I06e196559ec0e84da77d8866355ae7f86ba43f73
Reviewed-on: https://code.wireshark.org/review/7020
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dwarf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dwarf.c b/epan/dwarf.c index 910a6407b5..eb55dd78f3 100644 --- a/epan/dwarf.c +++ b/epan/dwarf.c @@ -39,7 +39,7 @@ dissect_uleb128(tvbuff_t *tvb, gint offset, guint64 *value) byte = tvb_get_guint8(tvb, offset); offset += 1; - *value |= (byte & 0x7F) << shift; + *value |= ((guint64)(byte & 0x7F) << shift); shift += 7; } while (byte & 0x80); @@ -59,7 +59,7 @@ dissect_leb128(tvbuff_t *tvb, gint offset, gint64 *value) byte = tvb_get_guint8(tvb, offset); offset += 1; - *value |= (byte & 0x7F) << shift; + *value |= ((guint64)(byte & 0x7F) << shift); shift += 7; } while (byte & 0x80); |