From 853d55b871a95e12cd463df3773eb6f88663380d Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Mon, 30 Aug 2021 06:41:56 +0200 Subject: [PATCH] pcapng: declare offset to be volatile to fix build error on aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This attempts to fix an error encountered when building Wireshark on aarch64: [254/2488] Building C object epan/dissectors/CMakeFiles/dissectors.dir/file-pcapng.c.o FAILED: epan/dissectors/CMakeFiles/dissectors.dir/file-pcapng.c.o /usr/bin/cc -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DWS_BUILD_DLL -I. -isystem /usr/include/glib-2.0 -isystem /usr/lib/aarch64-linux-gnu/glib-2.0/include -isystem /usr/include/libxml2 -isystem epan/dissectors -isystem epan -fvisibility=hidden -fexcess-precision=fast -Wall -Wextra -Wendif-labels -Wpointer-arith -Wformat-security -fwrapv -fno-strict-overflow -Wvla -Waddress -Wattributes -Wdiv-by-zero -Wignored-qualifiers -Wpragmas -Wno-overlength-strings -Wno-long-long -Wredundant-decls -Wframe-larger-than=32768 -fdiagnostics-color=always -Wunused-const-variable -Wshadow -Wold-style-definition -Wstrict-prototypes -Wlogical-op -Wjump-misses-init -Werror=implicit -Wno-pointer-sign -std=gnu99 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fmacro-prefix-map=/run/build/wireshark/= -fmacro-prefix-map=/run/build/wireshark/= -O2 -g -DNDEBUG -fPIC -Werror -MD -MT epan/dissectors/CMakeFiles/dissectors.dir/file-pcapng.c.o -MF epan/dissectors/CMakeFiles/dissectors.dir/file-pcapng.c.o.d -o epan/dissectors/CMakeFiles/dissectors.dir/file-pcapng.c.o -c epan/dissectors/file-pcapng.c epan/dissectors/file-pcapng.c: In function ‘dissect_spb_data’: epan/dissectors/file-pcapng.c:1599:9: error: variable ‘offset’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] 1599 | int offset = 0; | ^~~~~~ epan/dissectors/file-pcapng.c: In function ‘dissect_epb_data’: epan/dissectors/file-pcapng.c:1791:9: error: variable ‘offset’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] 1791 | int offset = 0; | ^~~~~~ epan/dissectors/file-pcapng.c: In function ‘dissect_pb_data’: epan/dissectors/file-pcapng.c:1541:9: error: variable ‘offset’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] 1541 | int offset = 0; | ^~~~~~ cc1: all warnings being treated as errors [255/2488] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-autosar-nm.c.o [256/2488] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-bblog.c.o Fixes: https://gitlab.com/wireshark/wireshark/-/issues/17554 --- epan/dissectors/file-pcapng.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epan/dissectors/file-pcapng.c b/epan/dissectors/file-pcapng.c index 2c74084881..fc393c8d14 100644 --- a/epan/dissectors/file-pcapng.c +++ b/epan/dissectors/file-pcapng.c @@ -1538,7 +1538,7 @@ static void dissect_pb_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, block_data_arg *argp) { - int offset = 0; + volatile int offset = 0; guint32 interface_id; struct interface_description *interface_description; guint32 captured_length; @@ -1596,7 +1596,7 @@ static void dissect_spb_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, block_data_arg *argp) { - int offset = 0; + volatile int offset = 0; struct interface_description *interface_description; proto_item *ti; volatile guint32 captured_length; @@ -1788,7 +1788,7 @@ static void dissect_epb_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, block_data_arg *argp) { - int offset = 0; + volatile int offset = 0; guint32 interface_id; struct interface_description *interface_description; guint32 captured_length;