Xilinx-CNS / solarcapture

SolarCapture network packet capture suite
Other
13 stars 8 forks source link

Fails to compile with -Werror=use-after-free enabled for recent GCC #10

Closed nodakai closed 1 month ago

nodakai commented 4 months ago

Looks like a real bug to me, not a false alarm.

https://github.com/Xilinx-CNS/solarcapture/blob/2fd9eb9d3f7a8dd7a0ec37f15f35ad2eca5770ee/src/core/sc_vi.c#L73-L77

In file included from include/sc_internal.h:26,
                 from core/internal.h:13,
                 from core/sc_vi.c:6:
core/sc_vi.c: In function 'sc_vi_group_alloc__ef_vi':
include/sc_internal/utils.h:104:3: error: pointer 'vi_group' used after 'free' [-Werror=use-after-free]
  104 |   __sc_set_err((tg), __FILE__, __LINE__, __func__, (errno_code), __VA_ARGS__)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/sc_vi.c:74:14: note: in expansion of macro 'sc_set_err'
   74 |       return sc_set_err(tg, EINVAL, "ERROR: %s: Set strip_fcs=%"PRId64", but interface"
      |              ^~~~~~~~~~
core/sc_vi.c:73:7: note: call to 'free' here
   73 |       free(vi_group);
      |       ^~~~~~~~~~~~~~
abrunnin-xilinx commented 1 month ago

Thanks for catching this; should be resolved now.