couchbase: check shift value before use.

Bug: 15439
Change-Id: I5bd702333795f2ed705eadb665516cb27b6e0371
Reviewed-on: https://code.wireshark.org/review/32311
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Dario Lombardo 2019-03-04 14:12:59 +01:00 committed by Anders Broman
parent 67b1db7815
commit 52203676cc
1 changed files with 3 additions and 0 deletions

View File

@ -1685,6 +1685,9 @@ dissect_unsigned_leb128(tvbuff_t *tvb, gint start, gint end, guint32* value) {
gint byte_idx;
for (byte_idx = start+1; byte_idx < end; byte_idx++) {
byte = tvb_get_guint8(tvb, byte_idx);
/* Ensure we are using a valid shift */
if (shift > 32)
return -1;
*value |= (byte & 0x7f) << shift;
if ((byte & 0x80) == 0) {
break;