[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using Clang's static analyzer on bash
From: |
Eduardo Bustamante |
Subject: |
Using Clang's static analyzer on bash |
Date: |
Sun, 23 Apr 2017 20:02:37 -0500 |
I built bash using scan-build
(https://clang-analyzer.llvm.org/scan-build.html) and I noticed that
it was able to detect the null pointer dereference reported earlier by
Jaren (https://lists.gnu.org/archive/html/bug-bash/2017-04/msg00100.html).
dualbus@debian:~/src/gnu/bash$ scan-build-3.9 make
scan-build: Using '/usr/lib/llvm-3.9/bin/clang' for static analysis
[...]
bashline.c:2548:7: warning: Null pointer argument in call to string
comparison function
if (strcmp (new_line, rl_line_buffer) != 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/string2.h:125:15: note: expanded
from macro 'strcmp'
: __builtin_strcmp (s1, s2)))); })
^~~~~~~~~~~~~~~~~~~~~~~~~
scan-build currently picks up 263 "bugs" from the devel branch. Maybe
there's value in reducing that number to 0. I think it could be useful
to uncover new bugs.
- Using Clang's static analyzer on bash,
Eduardo Bustamante <=