aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Sipos <brian.sipos@gmail.com>2022-10-21 19:24:28 -0400
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-10-24 15:29:15 +0000
commitc4b30942d031d9b8ff7286d5b892ecd6999c285c (patch)
tree11770268ece42c5fb9983a653eea747a17a25144
parent0647fc5f238f642212a0a058b45a315242cb5a45 (diff)
epan: Fix build errors about try/catch block on some compilers
The original error was identified in a comment on !8583
-rw-r--r--epan/tvbtest.c10
-rw-r--r--epan/tvbuff.c2
2 files changed, 8 insertions, 4 deletions
diff --git a/epan/tvbtest.c b/epan/tvbtest.c
index f9f5f445d2..6573092e43 100644
--- a/epan/tvbtest.c
+++ b/epan/tvbtest.c
@@ -656,15 +656,19 @@ static void
varint_tests(void)
{
tvbuff_t *tvb_parent, *tvb;
+ volatile unsigned long got_ex;
+ guint64 got_val;
+ volatile guint got_len;
+
tvb_parent = tvb_new_real_data((const guint8*)"", 0, 0);
for (size_t ix = 0; ix < (sizeof(varint) / sizeof(varint_test_s)); ++ix) {
const varint_test_s *vit = &varint[ix];
tvb = tvb_new_child_real_data(tvb_parent, vit->enc, vit->enc_len, vit->enc_len);
- unsigned long got_ex = 0;
- guint64 got_val = 0;
- guint got_len = 0;
+ got_ex = 0;
+ got_val = 0;
+ got_len = 0;
TRY {
got_len = tvb_get_varint(tvb, 0, vit->maxlen, &got_val, vit->encoding);
}
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index be23e3408f..ab1c075fb9 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -4571,7 +4571,7 @@ tvb_get_varint(tvbuff_t *tvb, guint offset, guint maxlen, guint64 *value, const
for (i = 0; ((i < FT_VARINT_MAX_LEN) && (i < maxlen)); ++i) {
b = tvb_get_guint8(tvb, offset++);
- if ((i == 9) && (*value >= (uint64_t)1<<(64-7))) {
+ if ((i == 9) && (*value >= G_GUINT64_CONSTANT(1)<<(64-7))) {
// guaranteed overflow, not valid SDNV
return 0;
}