Skip to content

Commit 46be337

Browse files
committed
CI: update list of compilers
Try using latest gcc and clang versions. We still care about RHEL7: since handling a RHEL7 runner on GitHub is quite complex, let try to use a similar version of gcc, at least
1 parent 149067b commit 46be337

File tree

3 files changed

+38
-18
lines changed

3 files changed

+38
-18
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ jobs:
8989
nBPF: [""]
9090
lto_gold_linker: [""]
9191
include:
92-
- compiler: "gcc-7" # "Oldest" gcc easily available
92+
- compiler: "gcc-4.9" # "Oldest" gcc easily available. To simulate RHEL7
9393
os: ubuntu-20.04
9494
arch: "x86_64"
9595
gcrypt: ""
9696
pcre: "--with-pcre2"
9797
maxminddb: "--with-maxminddb"
9898
msan: "--with-sanitizer"
9999
nBPF: ""
100-
- compiler: "gcc-12" # "Newest" gcc easily available
100+
- compiler: "gcc-13" # "Newest" gcc easily available
101101
os: ubuntu-22.04
102102
arch: "x86_64"
103103
gcrypt: ""
@@ -114,9 +114,9 @@ jobs:
114114
maxminddb: "--with-maxminddb"
115115
msan: "--with-sanitizer"
116116
nBPF: ""
117-
- compiler: "clang-14" # "Newest" clang easily available
118-
ar: "llvm-ar-14"
119-
ranlib: "llvm-ranlib-14"
117+
- compiler: "clang-17" # "Newest" clang easily available
118+
ar: "llvm-ar-17"
119+
ranlib: "llvm-ranlib-17"
120120
os: ubuntu-22.04
121121
arch: "x86_64"
122122
gcrypt: ""
@@ -141,7 +141,7 @@ jobs:
141141
maxminddb: "--with-maxminddb"
142142
msan: "--with-sanitizer"
143143
nBPF: "nBPF"
144-
- compiler: "clang-14"
144+
- compiler: "clang-17"
145145
os: ubuntu-22.04
146146
arch: "x86_64"
147147
gcrypt: ""
@@ -226,9 +226,22 @@ jobs:
226226
make
227227
cd -
228228
- name: Setup Ubuntu specified compiler
229-
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && ! startsWith(matrix.compiler, 'cc')
230-
run: |
229+
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && ! startsWith(matrix.compiler, 'cc') && ! startsWith(matrix.compiler, 'clang-17')
230+
run: |
231+
#For gcc-4.9 (on ubuntu-20.04)
232+
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" | sudo tee -a /etc/apt/sources.list
233+
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" | sudo tee -a /etc/apt/sources.list
234+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
235+
#For gcc-13 (on ubuntu-22.04)
236+
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
237+
sudo apt-get update
231238
sudo apt-get install ${{ matrix.compiler }}
239+
- name: Setup Ubuntu specified (newest) compiler
240+
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'clang-17')
241+
run: |
242+
wget https://apt.llvm.org/llvm.sh
243+
chmod u+x llvm.sh
244+
sudo ./llvm.sh 17
232245
- name: Install Windows msys2 prerequisites
233246
if: startsWith(matrix.os, 'windows')
234247
uses: msys2/setup-msys2@v2

configure.ac

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,14 @@ AS_IF([test "${with_sanitizer+set}" = set -o "${with_thread_sanitizer+set}" = se
6464
])
6565

6666
AS_IF([test "${with_sanitizer+set}" = set],[
67-
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak -fno-omit-frame-pointer"
68-
NDPI_LDFLAGS="${NDPI_LDFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak"
67+
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fno-omit-frame-pointer"
68+
NDPI_LDFLAGS="${NDPI_LDFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak"
69+
#Sanitizers should work on any compilers that we support (or that we test on CI, at least)
70+
#Exception: "-fsanitize=alignment" is not supported in gcc 4.9
71+
AX_CHECK_COMPILE_FLAG([-fno-sanitize=alignment], [
72+
NDPI_CFLAGS="${NDPI_CFLAGS} -fno-sanitize=alignment"
73+
NDPI_LDFLAGS="${NDPI_LDFLAGS} -fno-sanitize=alignment"
74+
])
6975
])
7076

7177
AS_IF([test "${with_thread_sanitizer+set}" = set],[

src/lib/ndpi_utils.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,9 +1708,9 @@ static int ndpi_is_xss_injection(char* query) {
17081708
static void ndpi_compile_rce_regex() {
17091709
PCRE2_UCHAR pcreErrorStr[128];
17101710
PCRE2_SIZE pcreErrorOffset;
1711-
int pcreErrorCode;
1711+
int i, pcreErrorCode;
17121712

1713-
for(int i = 0; i < N_RCE_REGEX; i++) {
1713+
for(i = 0; i < N_RCE_REGEX; i++) {
17141714
comp_rx[i] = (struct pcre2_struct*)ndpi_malloc(sizeof(struct pcre2_struct));
17151715

17161716
comp_rx[i]->compiled = pcre2_compile((PCRE2_SPTR)rce_regex[i], PCRE2_ZERO_TERMINATED, 0, &pcreErrorCode,
@@ -1746,9 +1746,10 @@ static int ndpi_is_rce_injection(char* query) {
17461746
}
17471747

17481748
pcre2_match_data *pcreMatchData;
1749-
int pcreExecRet;
1749+
int i, pcreExecRet;
1750+
unsigned long j;
17501751

1751-
for(int i = 0; i < N_RCE_REGEX; i++) {
1752+
for(i = 0; i < N_RCE_REGEX; i++) {
17521753
unsigned int length = strlen(query);
17531754

17541755
pcreMatchData = pcre2_match_data_create_from_pattern(comp_rx[i]->compiled, NULL);
@@ -1789,16 +1790,16 @@ static int ndpi_is_rce_injection(char* query) {
17891790

17901791
size_t ushlen = sizeof(ush_commands) / sizeof(ush_commands[0]);
17911792

1792-
for(unsigned long i = 0; i < ushlen; i++) {
1793-
if(strstr(query, ush_commands[i]) != NULL) {
1793+
for(j = 0; j < ushlen; i++) {
1794+
if(strstr(query, ush_commands[j]) != NULL) {
17941795
return 1;
17951796
}
17961797
}
17971798

17981799
size_t pwshlen = sizeof(pwsh_commands) / sizeof(pwsh_commands[0]);
17991800

1800-
for(unsigned long i = 0; i < pwshlen; i++) {
1801-
if(strstr(query, pwsh_commands[i]) != NULL) {
1801+
for(j = 0; j < pwshlen; i++) {
1802+
if(strstr(query, pwsh_commands[j]) != NULL) {
18021803
return 1;
18031804
}
18041805
}

0 commit comments

Comments
 (0)