pcapng: declare offset to be volatile to fix build error on aarch64

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
This commit is contained in:
Tobias Mueller 2021-08-30 06:41:56 +02:00 committed by Wireshark GitLab Utility
parent 40aebad079
commit 853d55b871
1 changed files with 3 additions and 3 deletions

View File

@ -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;