ossobv / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
0 stars 0 forks source link

build: librdb use-after-free false positive #23

Closed wdoekes closed 2 days ago

wdoekes commented 1 week ago

Description

rax.c: In function 'raxRemove':
rax.c:1064:28: error: pointer 'h' may be used after 'free' [-Werror=use-after-free]
 1064 |             raxNode *new = raxRemoveChild(h,child);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from rax.c:45:
rax_malloc.h:44:18: note: call to 'free' here
   44 | #define rax_free free
rax.c:1054:13: note: in expansion of macro 'rax_free'
 1054 |             rax_free(child);
      |             ^~~~~~~~

During build of librdb.

Which build are we running (if any)

upstream c8e588808075ed02a92eb81cd1507df9cc2753ce + ossomain

Upstream issues/PRs

github.com/sonic-net/sonic-buildimage/issues 20757

Fix

--- a/src/rdb-cli/Makefile
+++ b/src/rdb-cli/Makefile
@@ -10,5 +10,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
        pushd ./librdb/
        git checkout 2fdfc0c2bc914d643fe3f86e6715aeb843d8966e
        git submodule update --init --recursive 
-       make -j$(SONIC_CONFIG_MAKE_JOBS)
+       # Set WARNS=... to work around https://github.com/redis/librdb/issues/55
+       make -j$(SONIC_CONFIG_MAKE_JOBS) WARNS='-Wall -Wextra -pedantic -flto=auto'
        mv bin/rdb-cli $(DEST)/