Compilation error: analyzer-deref-before-check #33

Closed
opened 2024-02-22 15:37:08 -05:00 by tasiaiso · 0 comments
Contributor

Here's a warning I've had since the beginning that I had to silence the compiler to get it to compile.

$ make -j4 -Wno-error=analyzer-deref-before-check

which: no adb in (/home/user/Android/Sdk/platform-tools)
which: no x86_64-w64-mingw32-gcc-win32 in (/nix/store/1zslabm02hi75anb2w8zjrqwzgs0vrs3-bash-interactive-5.2p26/bin:/nix/store/v3b4la4kh5l7dqzdyraqb1lyfrajfl5w-patchelf-0.15.0/bin:/nix/store/4cjqvbp1jbkps185wl8qnbjpf8bdy8j9-gcc-wrapper-13.2.0/bin:/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/bin:/nix/store/36wymklsa60bigdhb0p3139ws02r46lw-glibc-2.38-44-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/c53f8hagyblvx52zylsnqcc0b3nxbrcl-binutils-wrapper-2.40/bin:/nix/store/2ab5740x0cy1d74qvbpl5s28qikmppl5-binutils-2.40/bin:/nix/store/68xavaskkydpk2bgzg4xhzx8rnhsqf05-openssl-3.0.13-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/p6fd7piqrin2h0mqxzmvyxyr6pyivndj-findutils-4.9.0/bin:/nix/store/2d582qba31ii28nyrww9bzb00aq06d1g-diffutils-3.10/bin:/nix/store/vd92lhcxs39hbdnzj8ycak5wvj466s3l-gnused-4.9/bin:/nix/store/mn911d51n5lklwr3zy4mdhxa77wzancb-gnugrep-3.11/bin:/nix/store/h53ycc406fmbq3ff0n0rjxdzb6lk9zcn-gawk-5.2.2/bin:/nix/store/1ds6c0i7z4advdr0z210sxgvmq786h09-gnutar-1.35/bin:/nix/store/nf4fhdqgjka360nkibx1yg14gybwb018-gzip-1.13/bin:/nix/store/v3hp6kidlb9yz6j51a0wlbnpclqpi94f-bzip2-1.0.8-bin/bin:/nix/store/15xrks0frcgils8qxfkhspyg6gi9rxdh-gnumake-4.4.1/bin:/nix/store/5l50g7kzj7v0rdhshld1vx46rf2k5lf9-bash-5.2p26/bin:/nix/store/2pi9hb31np2vhy8r9lfih47rf9n51crz-patch-2.7.6/bin:/nix/store/h8vfiwhq6kmvrnj96w52n36c6qm4lbyl-xz-5.4.6-bin/bin:/nix/store/rn6yfzxwp12z0zqavxx1841mh0ypr7jg-file-5.45/bin:/run/wrappers/bin:/home/user/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/user/.nix-profile/bin:/nix/profile/bin:/home/user/.local/state/nix/profile/bin:/etc/profiles/per-user/user/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)
which: no bin in (./deps/ios_toolchain/target)
which: no arm-apple-darwin11-clang in (./deps/ios_toolchain/target/bin)
which: no bin in (./deps/ios_toolchain/target)
which: no arm-apple-darwin11-clang in (./deps/ios_toolchain/target/bin)
which: no x86_64-w64-mingw32-gcc-win32 in (/nix/store/1zslabm02hi75anb2w8zjrqwzgs0vrs3-bash-interactive-5.2p26/bin:/nix/store/v3b4la4kh5l7dqzdyraqb1lyfrajfl5w-patchelf-0.15.0/bin:/nix/store/4cjqvbp1jbkps185wl8qnbjpf8bdy8j9-gcc-wrapper-13.2.0/bin:/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/bin:/nix/store/36wymklsa60bigdhb0p3139ws02r46lw-glibc-2.38-44-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/c53f8hagyblvx52zylsnqcc0b3nxbrcl-binutils-wrapper-2.40/bin:/nix/store/2ab5740x0cy1d74qvbpl5s28qikmppl5-binutils-2.40/bin:/nix/store/68xavaskkydpk2bgzg4xhzx8rnhsqf05-openssl-3.0.13-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/p6fd7piqrin2h0mqxzmvyxyr6pyivndj-findutils-4.9.0/bin:/nix/store/2d582qba31ii28nyrww9bzb00aq06d1g-diffutils-3.10/bin:/nix/store/vd92lhcxs39hbdnzj8ycak5wvj466s3l-gnused-4.9/bin:/nix/store/mn911d51n5lklwr3zy4mdhxa77wzancb-gnugrep-3.11/bin:/nix/store/h53ycc406fmbq3ff0n0rjxdzb6lk9zcn-gawk-5.2.2/bin:/nix/store/1ds6c0i7z4advdr0z210sxgvmq786h09-gnutar-1.35/bin:/nix/store/nf4fhdqgjka360nkibx1yg14gybwb018-gzip-1.13/bin:/nix/store/v3hp6kidlb9yz6j51a0wlbnpclqpi94f-bzip2-1.0.8-bin/bin:/nix/store/15xrks0frcgils8qxfkhspyg6gi9rxdh-gnumake-4.4.1/bin:/nix/store/5l50g7kzj7v0rdhshld1vx46rf2k5lf9-bash-5.2p26/bin:/nix/store/2pi9hb31np2vhy8r9lfih47rf9n51crz-patch-2.7.6/bin:/nix/store/h8vfiwhq6kmvrnj96w52n36c6qm4lbyl-xz-5.4.6-bin/bin:/nix/store/rn6yfzxwp12z0zqavxx1841mh0ypr7jg-file-5.45/bin:/run/wrappers/bin:/home/user/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/user/.nix-profile/bin:/nix/profile/bin:/home/user/.local/state/nix/profile/bin:/etc/profiles/per-user/user/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)
[c] out/debug/src/file.js.o
[c] out/debug/src/httpd.js.o
[c] out/debug/src/mem.o
[c] out/debug/src/packetstream.o
src/file.js.c: In function ‘tf_file_stat’:
src/file.js.c:459:9: warning: check of ‘path’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  459 |         memcpy(data->path, path, path_length);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘tf_file_stat’: events 1-4
    |
    |  456 |         size_t path_length = strlen(path) + 1;
    |      |                              ^~~~~~~~~~~~
    |      |                              |
    |      |                              (1) pointer ‘path’ is dereferenced here
    |......
    |  459 |         memcpy(data->path, path, path_length);
    |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |         |
    |      |         (2) following ‘false’ branch...
    |      |         (3) ...to here
    |      |         (4) pointer ‘path’ is checked for NULL here but it was already dereferenced at (1)
    |
src/file.js.c: In function ‘tf_file_read’:
src/file.js.c:585:9: warning: check of ‘path’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  585 |         memcpy(data->path, path, path_length);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘tf_file_read’: events 1-4
    |
    |  578 |         size_t path_length = strlen(path) + 1;
    |      |                              ^~~~~~~~~~~~
    |      |                              |
    |      |                              (1) pointer ‘path’ is dereferenced here
    |......
    |  585 |         memcpy(data->path, path, path_length);
    |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |         |
    |      |         (2) following ‘false’ branch...
    |      |         (3) ...to here
    |      |         (4) pointer ‘path’ is checked for NULL here but it was already dereferenced at (1)
    |
[c] out/debug/src/serialize.o
[c] out/debug/src/socket.js.o
src/httpd.js.c: In function ‘_after’:
src/httpd.js.c:513:13: warning: check of ‘prefix’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  513 |         if (strncmp(text, prefix, prefix_length) == 0)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘_after’: events 1-2
    |
    |  512 |         size_t prefix_length = strlen(prefix);
    |      |                                ^~~~~~~~~~~~~~
    |      |                                |
    |      |                                (1) pointer ‘prefix’ is dereferenced here
    |  513 |         if (strncmp(text, prefix, prefix_length) == 0)
    |      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |             |
    |      |             (2) pointer ‘prefix’ is checked for NULL here but it was already dereferenced at (1)
    |
src/httpd.js.c:513:13: warning: check of ‘prefix’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  513 |         if (strncmp(text, prefix, prefix_length) == 0)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘_httpd_endpoint_static’: events 1-4
    |
    |  621 | static void _httpd_endpoint_static(tf_http_request_t* request)
    |      |             ^~~~~~~~~~~~~~~~~~~~~~
    |      |             |
    |      |             (1) entry to ‘_httpd_endpoint_static’
    |......
    |  650 |         for (int i = 0; i < tf_countof(k_map) && !after; i++)
    |      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                                               |
    |      |                                               (2) following ‘true’ branch...
    |  651 |         {
    |  652 |                 after = _after(request->path, k_map[i][0]);
    |      |                 ~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                 |       |
    |      |                 |       (4) calling ‘_after’ from ‘_httpd_endpoint_static’
    |      |                 (3) ...to here
    |
    +--> ‘_after’: events 5-7
           |
           |  510 | static const char* _after(const char* text, const char* prefix)
           |      |                    ^~~~~~
           |      |                    |
           |      |                    (5) entry to ‘_after’
           |  511 | {
           |  512 |         size_t prefix_length = strlen(prefix);
           |      |                                ~~~~~~~~~~~~~~
           |      |                                |
           |      |                                (6) pointer ‘prefix’ is dereferenced here
           |  513 |         if (strncmp(text, prefix, prefix_length) == 0)
           |      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |             |
           |      |             (7) pointer ‘prefix’ is checked for NULL here but it was already dereferenced at (6)
           |
[c] out/debug/src/ssb.o
[c] out/debug/src/ssb.connections.o
[c] out/debug/src/ssb.db.o
[c] out/debug/src/ssb.export.o
[c] out/debug/src/ssb.import.o
[c] out/debug/src/ssb.js.o
[c] out/debug/src/ssb.rpc.o
[c] out/debug/src/ssb.tests.o
[version] src/version.h
[c] out/debug/src/taskstub.js.o
[c] out/debug/src/tests.o
[c] out/debug/src/tls.o
[c] out/debug/src/tlscontext.js.o
[c] out/debug/src/trace.o
[c] out/debug/src/util.js.o
[c] out/release/src/bcrypt.js.o
[c] out/release/src/bip39.o
[c] out/release/src/bip39.words.o
[c] out/release/src/database.js.o
[c] out/release/src/file.js.o
[c] out/release/src/http.o
[c] out/release/src/httpd.js.o
[c] out/release/src/main.o
[c] out/release/src/mem.o
[c] out/release/src/packetstream.o
[c] out/release/src/serialize.o
[c] out/release/src/socket.js.o
[c] out/release/src/ssb.o
[c] out/release/src/ssb.connections.o
[c] out/release/src/ssb.db.o
[c] out/release/src/ssb.export.o
[c] out/release/src/ssb.import.o
[c] out/release/src/ssb.js.o
[c] out/release/src/ssb.rpc.o
[c] out/release/src/ssb.tests.o
[c] out/release/src/task.o
[c] out/release/src/taskstub.js.o
[c] out/release/src/tests.o
[c] out/release/src/tls.o
[c] out/release/src/tlscontext.js.o
[c] out/release/src/trace.o
[c] out/release/src/util.js.o
[c] out/debug/src/task.o
[link] out/release/tildefriends
[link] out/debug/tildefriends
$ gcc -v

Using built-in specs.
COLLECT_GCC=/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/bin/gcc
COLLECT_LTO_WRAPPER=/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-13.2.0/configure --prefix=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gcc-13.2.0 --with-gmp-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-6.3.0-dev/include --with-gmp-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-6.3.0/lib --with-mpfr-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.1-dev/include --with-mpfr-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.1/lib --with-mpc=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libmpc-1.3.1 --with-native-system-header-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-glibc-2.38-44-dev/include --with-build-sysroot=/ --with-gxx-include-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gcc-13.2.0/include/c++/13.2.0/ --program-prefix= --enable-lto --disable-libstdcxx-pch --without-included-gettext --with-system-zlib --enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin --disable-libcc1 --with-isl=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-isl-0.20 --disable-bootstrap --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (GCC)

NixOS 24.05, tell me if you need more info.

Here's a warning I've had since the beginning that I had to silence the compiler to get it to compile. ``` $ make -j4 -Wno-error=analyzer-deref-before-check which: no adb in (/home/user/Android/Sdk/platform-tools) which: no x86_64-w64-mingw32-gcc-win32 in (/nix/store/1zslabm02hi75anb2w8zjrqwzgs0vrs3-bash-interactive-5.2p26/bin:/nix/store/v3b4la4kh5l7dqzdyraqb1lyfrajfl5w-patchelf-0.15.0/bin:/nix/store/4cjqvbp1jbkps185wl8qnbjpf8bdy8j9-gcc-wrapper-13.2.0/bin:/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/bin:/nix/store/36wymklsa60bigdhb0p3139ws02r46lw-glibc-2.38-44-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/c53f8hagyblvx52zylsnqcc0b3nxbrcl-binutils-wrapper-2.40/bin:/nix/store/2ab5740x0cy1d74qvbpl5s28qikmppl5-binutils-2.40/bin:/nix/store/68xavaskkydpk2bgzg4xhzx8rnhsqf05-openssl-3.0.13-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/p6fd7piqrin2h0mqxzmvyxyr6pyivndj-findutils-4.9.0/bin:/nix/store/2d582qba31ii28nyrww9bzb00aq06d1g-diffutils-3.10/bin:/nix/store/vd92lhcxs39hbdnzj8ycak5wvj466s3l-gnused-4.9/bin:/nix/store/mn911d51n5lklwr3zy4mdhxa77wzancb-gnugrep-3.11/bin:/nix/store/h53ycc406fmbq3ff0n0rjxdzb6lk9zcn-gawk-5.2.2/bin:/nix/store/1ds6c0i7z4advdr0z210sxgvmq786h09-gnutar-1.35/bin:/nix/store/nf4fhdqgjka360nkibx1yg14gybwb018-gzip-1.13/bin:/nix/store/v3hp6kidlb9yz6j51a0wlbnpclqpi94f-bzip2-1.0.8-bin/bin:/nix/store/15xrks0frcgils8qxfkhspyg6gi9rxdh-gnumake-4.4.1/bin:/nix/store/5l50g7kzj7v0rdhshld1vx46rf2k5lf9-bash-5.2p26/bin:/nix/store/2pi9hb31np2vhy8r9lfih47rf9n51crz-patch-2.7.6/bin:/nix/store/h8vfiwhq6kmvrnj96w52n36c6qm4lbyl-xz-5.4.6-bin/bin:/nix/store/rn6yfzxwp12z0zqavxx1841mh0ypr7jg-file-5.45/bin:/run/wrappers/bin:/home/user/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/user/.nix-profile/bin:/nix/profile/bin:/home/user/.local/state/nix/profile/bin:/etc/profiles/per-user/user/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin) which: no bin in (./deps/ios_toolchain/target) which: no arm-apple-darwin11-clang in (./deps/ios_toolchain/target/bin) which: no bin in (./deps/ios_toolchain/target) which: no arm-apple-darwin11-clang in (./deps/ios_toolchain/target/bin) which: no x86_64-w64-mingw32-gcc-win32 in (/nix/store/1zslabm02hi75anb2w8zjrqwzgs0vrs3-bash-interactive-5.2p26/bin:/nix/store/v3b4la4kh5l7dqzdyraqb1lyfrajfl5w-patchelf-0.15.0/bin:/nix/store/4cjqvbp1jbkps185wl8qnbjpf8bdy8j9-gcc-wrapper-13.2.0/bin:/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/bin:/nix/store/36wymklsa60bigdhb0p3139ws02r46lw-glibc-2.38-44-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/c53f8hagyblvx52zylsnqcc0b3nxbrcl-binutils-wrapper-2.40/bin:/nix/store/2ab5740x0cy1d74qvbpl5s28qikmppl5-binutils-2.40/bin:/nix/store/68xavaskkydpk2bgzg4xhzx8rnhsqf05-openssl-3.0.13-bin/bin:/nix/store/bicmg5gd50q6igk0y5mga1v0p1lk8f26-coreutils-9.4/bin:/nix/store/p6fd7piqrin2h0mqxzmvyxyr6pyivndj-findutils-4.9.0/bin:/nix/store/2d582qba31ii28nyrww9bzb00aq06d1g-diffutils-3.10/bin:/nix/store/vd92lhcxs39hbdnzj8ycak5wvj466s3l-gnused-4.9/bin:/nix/store/mn911d51n5lklwr3zy4mdhxa77wzancb-gnugrep-3.11/bin:/nix/store/h53ycc406fmbq3ff0n0rjxdzb6lk9zcn-gawk-5.2.2/bin:/nix/store/1ds6c0i7z4advdr0z210sxgvmq786h09-gnutar-1.35/bin:/nix/store/nf4fhdqgjka360nkibx1yg14gybwb018-gzip-1.13/bin:/nix/store/v3hp6kidlb9yz6j51a0wlbnpclqpi94f-bzip2-1.0.8-bin/bin:/nix/store/15xrks0frcgils8qxfkhspyg6gi9rxdh-gnumake-4.4.1/bin:/nix/store/5l50g7kzj7v0rdhshld1vx46rf2k5lf9-bash-5.2p26/bin:/nix/store/2pi9hb31np2vhy8r9lfih47rf9n51crz-patch-2.7.6/bin:/nix/store/h8vfiwhq6kmvrnj96w52n36c6qm4lbyl-xz-5.4.6-bin/bin:/nix/store/rn6yfzxwp12z0zqavxx1841mh0ypr7jg-file-5.45/bin:/run/wrappers/bin:/home/user/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/user/.nix-profile/bin:/nix/profile/bin:/home/user/.local/state/nix/profile/bin:/etc/profiles/per-user/user/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin) [c] out/debug/src/file.js.o [c] out/debug/src/httpd.js.o [c] out/debug/src/mem.o [c] out/debug/src/packetstream.o src/file.js.c: In function ‘tf_file_stat’: src/file.js.c:459:9: warning: check of ‘path’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check] 459 | memcpy(data->path, path, path_length); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘tf_file_stat’: events 1-4 | | 456 | size_t path_length = strlen(path) + 1; | | ^~~~~~~~~~~~ | | | | | (1) pointer ‘path’ is dereferenced here |...... | 459 | memcpy(data->path, path, path_length); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) following ‘false’ branch... | | (3) ...to here | | (4) pointer ‘path’ is checked for NULL here but it was already dereferenced at (1) | src/file.js.c: In function ‘tf_file_read’: src/file.js.c:585:9: warning: check of ‘path’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check] 585 | memcpy(data->path, path, path_length); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘tf_file_read’: events 1-4 | | 578 | size_t path_length = strlen(path) + 1; | | ^~~~~~~~~~~~ | | | | | (1) pointer ‘path’ is dereferenced here |...... | 585 | memcpy(data->path, path, path_length); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) following ‘false’ branch... | | (3) ...to here | | (4) pointer ‘path’ is checked for NULL here but it was already dereferenced at (1) | [c] out/debug/src/serialize.o [c] out/debug/src/socket.js.o src/httpd.js.c: In function ‘_after’: src/httpd.js.c:513:13: warning: check of ‘prefix’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check] 513 | if (strncmp(text, prefix, prefix_length) == 0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘_after’: events 1-2 | | 512 | size_t prefix_length = strlen(prefix); | | ^~~~~~~~~~~~~~ | | | | | (1) pointer ‘prefix’ is dereferenced here | 513 | if (strncmp(text, prefix, prefix_length) == 0) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) pointer ‘prefix’ is checked for NULL here but it was already dereferenced at (1) | src/httpd.js.c:513:13: warning: check of ‘prefix’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check] 513 | if (strncmp(text, prefix, prefix_length) == 0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘_httpd_endpoint_static’: events 1-4 | | 621 | static void _httpd_endpoint_static(tf_http_request_t* request) | | ^~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) entry to ‘_httpd_endpoint_static’ |...... | 650 | for (int i = 0; i < tf_countof(k_map) && !after; i++) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) following ‘true’ branch... | 651 | { | 652 | after = _after(request->path, k_map[i][0]); | | ~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | (4) calling ‘_after’ from ‘_httpd_endpoint_static’ | | (3) ...to here | +--> ‘_after’: events 5-7 | | 510 | static const char* _after(const char* text, const char* prefix) | | ^~~~~~ | | | | | (5) entry to ‘_after’ | 511 | { | 512 | size_t prefix_length = strlen(prefix); | | ~~~~~~~~~~~~~~ | | | | | (6) pointer ‘prefix’ is dereferenced here | 513 | if (strncmp(text, prefix, prefix_length) == 0) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (7) pointer ‘prefix’ is checked for NULL here but it was already dereferenced at (6) | [c] out/debug/src/ssb.o [c] out/debug/src/ssb.connections.o [c] out/debug/src/ssb.db.o [c] out/debug/src/ssb.export.o [c] out/debug/src/ssb.import.o [c] out/debug/src/ssb.js.o [c] out/debug/src/ssb.rpc.o [c] out/debug/src/ssb.tests.o [version] src/version.h [c] out/debug/src/taskstub.js.o [c] out/debug/src/tests.o [c] out/debug/src/tls.o [c] out/debug/src/tlscontext.js.o [c] out/debug/src/trace.o [c] out/debug/src/util.js.o [c] out/release/src/bcrypt.js.o [c] out/release/src/bip39.o [c] out/release/src/bip39.words.o [c] out/release/src/database.js.o [c] out/release/src/file.js.o [c] out/release/src/http.o [c] out/release/src/httpd.js.o [c] out/release/src/main.o [c] out/release/src/mem.o [c] out/release/src/packetstream.o [c] out/release/src/serialize.o [c] out/release/src/socket.js.o [c] out/release/src/ssb.o [c] out/release/src/ssb.connections.o [c] out/release/src/ssb.db.o [c] out/release/src/ssb.export.o [c] out/release/src/ssb.import.o [c] out/release/src/ssb.js.o [c] out/release/src/ssb.rpc.o [c] out/release/src/ssb.tests.o [c] out/release/src/task.o [c] out/release/src/taskstub.js.o [c] out/release/src/tests.o [c] out/release/src/tls.o [c] out/release/src/tlscontext.js.o [c] out/release/src/trace.o [c] out/release/src/util.js.o [c] out/debug/src/task.o [link] out/release/tildefriends [link] out/debug/tildefriends ``` ``` $ gcc -v Using built-in specs. COLLECT_GCC=/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/bin/gcc COLLECT_LTO_WRAPPER=/nix/store/qs1nwzbp2ml3cxzsxihn82hl0w73snr0-gcc-13.2.0/libexec/gcc/x86_64-unknown-linux-gnu/13.2.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-13.2.0/configure --prefix=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gcc-13.2.0 --with-gmp-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-6.3.0-dev/include --with-gmp-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-6.3.0/lib --with-mpfr-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.1-dev/include --with-mpfr-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.1/lib --with-mpc=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libmpc-1.3.1 --with-native-system-header-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-glibc-2.38-44-dev/include --with-build-sysroot=/ --with-gxx-include-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gcc-13.2.0/include/c++/13.2.0/ --program-prefix= --enable-lto --disable-libstdcxx-pch --without-included-gettext --with-system-zlib --enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin --disable-libcc1 --with-isl=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-isl-0.20 --disable-bootstrap --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.2.0 (GCC) ``` NixOS 24.05, tell me if you need more info.
cory closed this issue 2024-02-22 20:14:18 -05:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cory/tildefriends#33
No description provided.