Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: config site
run: cd pjlib/include/pj && cp config_site_test.h config_site.h
- name: configure
run: CFLAGS="-g -fPIC" CXXFLAGS="-g -fPIC" LDFLAGS="-rdynamic" ./configure --enable-libwebrtc-aec3
run: CFLAGS="-g -fPIC -fsanitize=address" CXXFLAGS="-g -fPIC -fsanitize=address" LDFLAGS="-rdynamic -fsanitize=address" ./configure --enable-libwebrtc-aec3
- name: make
run: $MAKE_FAST
- name: swig bindings
Expand Down Expand Up @@ -100,11 +100,13 @@ jobs:
- name: config site
run: cd pjlib/include/pj && cp config_site_test.h config_site.h
- name: configure
run: CFLAGS="-g" LDFLAGS="-rdynamic" ./configure
run: CFLAGS="-g -fsanitize=address" CXXFLAGS="-fsanitize=address" LDFLAGS="-rdynamic -fsanitize=address" ./configure
- name: make
run: $MAKE_FAST
- name: pjlib-test
run: make pjlib-test
run: |
export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/tests/sanitizers/lsan.supp"
make pjlib-test
- name: pjlib-util-test
run: make pjlib-util-test
- name: pjnath-test
Expand All @@ -130,7 +132,7 @@ jobs:
- name: config site
run: cd pjlib/include/pj && cp config_site_test.h config_site.h
- name: configure
run: CFLAGS="-g" LDFLAGS="-rdynamic" ./configure
run: CFLAGS="-g -fsanitize=address" CXXFLAGS="-fsanitize=address" LDFLAGS="-rdynamic -fsanitize=address" ./configure
- name: make
run: $MAKE_FAST
- name: pjsip-test
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
- name: config site
run: cd pjlib/include/pj && cp config_site_test.h config_site.h && echo "#define PJMEDIA_HAS_VIDEO 1" >> config_site.h
- name: configure
run: CFLAGS="-g $(pkg-config --cflags openssl) $(pkg-config --cflags opencore-amrnb) -DHAS_VID_CODEC_TEST=0 -fPIC" LDFLAGS="$(pkg-config --libs-only-L openssl) $(pkg-config --libs-only-L opencore-amrnb)" CXXFLAGS="-g -fPIC" ./configure
run: CFLAGS="-g $(pkg-config --cflags openssl) $(pkg-config --cflags opencore-amrnb) -DHAS_VID_CODEC_TEST=0 -fPIC -fsanitize=address" LDFLAGS="$(pkg-config --libs-only-L openssl) $(pkg-config --libs-only-L opencore-amrnb) -fsanitize=address" CXXFLAGS="-g -fPIC -fsanitize=address" ./configure
- name: make
run: $MAKE_FAST
- name: set up Python
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
- name: config site
run: cd pjlib/include/pj && cp config_site_test.h config_site.h && echo "#define PJMEDIA_HAS_VIDEO 1" >> config_site.h
- name: configure
run: CFLAGS="-g $(pkg-config --cflags openssl) $(pkg-config --cflags opencore-amrnb)" LDFLAGS="$(pkg-config --libs-only-L openssl) $(pkg-config --libs-only-L opencore-amrnb)" ./configure
run: CFLAGS="-g $(pkg-config --cflags openssl) $(pkg-config --cflags opencore-amrnb) -fsanitize=address" LDFLAGS="$(pkg-config --libs-only-L openssl) $(pkg-config --libs-only-L opencore-amrnb) -fsanitize=address" CXXFLAGS="-fsanitize=address" ./configure
- name: make
run: $MAKE_FAST
- name: disable firewall
Expand Down Expand Up @@ -360,7 +360,7 @@ jobs:
- name: config site
run: cd pjlib/include/pj && cp config_site_test.h config_site.h && echo "#define PJMEDIA_HAS_VIDEO 1" >> config_site.h
- name: configure
run: CFLAGS="-g $(pkg-config --cflags openssl) $(pkg-config --cflags opencore-amrnb)" LDFLAGS="$(pkg-config --libs-only-L openssl) $(pkg-config --libs-only-L opencore-amrnb)" ./configure
run: CFLAGS="-g $(pkg-config --cflags openssl) $(pkg-config --cflags opencore-amrnb) -fsanitize=address" LDFLAGS="$(pkg-config --libs-only-L openssl) $(pkg-config --libs-only-L opencore-amrnb) -fsanitize=address" CXXFLAGS="-fsanitize=address" ./configure
- name: make
run: $MAKE_FAST
- name: disable firewall
Expand Down
2 changes: 2 additions & 0 deletions pjlib-util/src/pjlib-util-test/encryption.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ int encryption_benchmark()
((unsigned)(bytes) % (1024 * 1024)) / 1024));
}

pj_pool_release(pool);

return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion pjlib/src/pj/ssl_sock_ossl.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,11 @@ static pj_status_t init_openssl(void)
* SSL_free(), perhaps it is safer to obey this, the leak amount seems
* to be relatively small (<500 bytes) and should occur once only in
* the library lifetime.
* Update 2026: reenabled since OpenSSL 1.0.x has been EOL since 2019.
*/
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
SSL_SESSION_free(ssl_sess);
#endif
*/

SSL_CTX_free(ctx);
}
Expand Down
16 changes: 15 additions & 1 deletion pjlib/src/pjlib-test/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,21 @@ static int test_timer_heap(void)
* bug in the implementation (note that race message is ok).
*/
#define RANDOMIZED_TEST 1
#define SIMULATE_CRASH PJ_TIMER_USE_COPY

#ifndef __has_feature
#define __has_feature(x) 0
#endif
#if defined(__SANITIZE_ADDRESS__) || \
(defined(__has_feature) && __has_feature(address_sanitizer))
#define ASAN_ENABLED 1
#else
#define ASAN_ENABLED 0
#endif

/* We should only simulate timer crash when using duplicate and
* not using ASan.
*/
#define SIMULATE_CRASH PJ_TIMER_USE_COPY && !ASAN_ENABLED

#if RANDOMIZED_TEST
#define ST_STRESS_THREAD_COUNT 20
Expand Down
16 changes: 15 additions & 1 deletion pjsip/src/test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
extern pjsip_endpoint *endpt;
extern pj_caching_pool caching_pool;

/* Check if we are using ASan */
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#if defined(__SANITIZE_ADDRESS__) || \
(defined(__has_feature) && __has_feature(address_sanitizer))
#define ASAN_ENABLED 1
#else
#define ASAN_ENABLED 0
#endif

#define TEST_UDP_PORT 15060
#define TEST_UDP_PORT_STR "15060"

Expand Down Expand Up @@ -61,7 +72,10 @@ extern pj_caching_pool caching_pool;
#endif

#define INCLUDE_URI_TEST INCLUDE_MESSAGING_GROUP
#define INCLUDE_MSG_TEST INCLUDE_MESSAGING_GROUP
/* Do not run message test under ASan, as sip_parser's longjmp mechanism
* will cause issues.
*/
#define INCLUDE_MSG_TEST (INCLUDE_MESSAGING_GROUP && !ASAN_ENABLED)
#define INCLUDE_MULTIPART_TEST INCLUDE_MESSAGING_GROUP
#define INCLUDE_TXDATA_TEST INCLUDE_MESSAGING_GROUP
#define INCLUDE_TSX_BENCH (INCLUDE_MESSAGING_GROUP && WITH_BENCHMARK)
Expand Down
3 changes: 3 additions & 0 deletions tests/sanitizers/lsan.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
leak:ASN1_STRING_set
leak:PEM_ASN1_read_bio
leak:libcrypto.so
Loading