Skip to content

Commit

Permalink
Merge branch 'main' into coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jan 21, 2025
2 parents 56335b3 + 107c7f6 commit f3f1ad3
Show file tree
Hide file tree
Showing 28 changed files with 617 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: cmake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -Werror -DCMAKE_C_FLAGS="-Werror"
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"
cmake --build build -t retest
- name: retest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake_win.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake and Windows
name: Windows

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
coverage:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

env:
CMAKE_GENERATOR: Ninja
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
MinGW-w64-build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

env:
CMAKE_GENERATOR: Ninja
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
sanitizer: [thread, address, undefined]
env:
CC: clang-18
CXX: clang++-18
CMAKE_GENERATOR: Ninja
CFLAGS: "-fsanitize=${{ matrix.sanitizer }} -fno-sanitize-recover=all -fno-sanitize=function"
CXXFLAGS: "-fsanitize=${{ matrix.sanitizer }} -fno-sanitize-recover=all -fno-sanitize=function"
ASAN_OPTIONS: fast_unwind_on_malloc=0

steps:
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## v3.19.0 - 2025-01-15

## What's Changed
* fmt: fix pl trim methods and add tests by @maximilianfridrich in https://github.com/baresip/re/pull/1226
* sipsess: add sipsess_msg getter function by @cspiel1 in https://github.com/baresip/re/pull/1225
* rtp/sess: fix missing srate_tx locking by @sreimers in https://github.com/baresip/re/pull/1231
* rtcp: use rtcp_rtpfb_gnack_encode() function by @alfredh in https://github.com/baresip/re/pull/1233
* net/linux: add net_netlink_addrs by @sreimers in https://github.com/baresip/re/pull/1232
* tcp,udp: set TOS (TCLASS) for IPv6 sockets by @maximilianfridrich in https://github.com/baresip/re/pull/1218
* sys/fs: fix fs_fopen return null check by @sreimers in https://github.com/baresip/re/pull/1237
* test: remove mock tcp-server (unused) by @alfredh in https://github.com/baresip/re/pull/1235
* rtp: remove rtcp_psfb_sli_encode() (unused) by @alfredh in https://github.com/baresip/re/pull/1234
* ci/clang: bump clang-18 and use ubuntu 24.04 by @sreimers in https://github.com/baresip/re/pull/1236
* net/linux/addrs: fix point-to-point peer address bug by @sreimers in https://github.com/baresip/re/pull/1239
* ci/coverage: bump min_cov by @sreimers in https://github.com/baresip/re/pull/1241
* ci/sanitizers: bump clang and ubuntu by @sreimers in https://github.com/baresip/re/pull/1242
* net/linux/addrs: fix netlink kernel warnings by @sreimers in https://github.com/baresip/re/pull/1243
* rem: add au_ prefix to calc_nsamp() by @alfredh in https://github.com/baresip/re/pull/1244
* rem/vidconv: add vidconv_center and x and y source offsets by @sreimers in https://github.com/baresip/re/pull/1240
* test: add testcode for rem au-module by @alfredh in https://github.com/baresip/re/pull/1245
* mem: remove peak from memstat by @alfredh in https://github.com/baresip/re/pull/1238
* debian: replace with CPack DEB Generator by @sreimers in https://github.com/baresip/re/pull/1247
* copyright: happy new year 2025 by @sreimers in https://github.com/baresip/re/pull/1246
* test/vidconv: remove static struct test by @sreimers in https://github.com/baresip/re/pull/1248
* net/linux/addrs: use list instead of fixed array for interface up by @sreimers in https://github.com/baresip/re/pull/1251
* test: optional IPv6 for tcp/udp tos test by @alfredh in https://github.com/baresip/re/pull/1252
* cmake: update min requirement and use range by @sreimers in https://github.com/baresip/re/pull/1253
* rem/vid/frame: fix vidframe init by @sreimers in https://github.com/baresip/re/pull/1257
* atomic: fix compilation for C++ and Windows-ARM64 by @alfredh in https://github.com/baresip/re/pull/1259
* test: add test for C++ applications by @alfredh in https://github.com/baresip/re/pull/1254
* ci: use ubuntu-22.04 were needed by @sreimers in https://github.com/baresip/re/pull/1261
* cmake: enable compiler warnings for C only by @alfredh in https://github.com/baresip/re/pull/1263


**Full Changelog**: https://github.com/baresip/re/compare/v3.18.0...v3.19.0


## v3.18.0 - 2024-12-11

## What's Changed
Expand Down
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
# Versioning
#

cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.15...3.31)

project(re
VERSION 3.18.0
VERSION 3.19.0
LANGUAGES C
HOMEPAGE_URL https://github.com/baresip/re
DESCRIPTION "Generic library for real-time communications"
)

set(PROJECT_SOVERSION 28) # bump if ABI breaks
set(PROJECT_SOVERSION 29) # bump if ABI breaks

# Pre-release identifier, comment out on a release
# Increment for breaking changes (dev2, dev3...)
Expand Down Expand Up @@ -63,7 +63,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(MSVC)
add_compile_options("/W3")
else()
add_compile_options(

set(c_flags
-pedantic
-Wall
-Wbad-function-cast
Expand All @@ -79,19 +80,23 @@ else()
-Wuninitialized
-Wvla
)

add_compile_options(
"$<$<COMPILE_LANGUAGE:C>:${c_flags}>"
)
endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(
-Wshorten-64-to-32
-Wno-gnu-zero-variadic-macro-arguments
-Wno-c2x-extensions
)
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Wshorten-64-to-32>")
endif()

check_c_compiler_flag("-Watomic-implicit-seq-cst" COMPILER_SUPPORTS_WATOMIC)
if(COMPILER_SUPPORTS_WATOMIC)
add_compile_options(-Watomic-implicit-seq-cst)
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Watomic-implicit-seq-cst>")
endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
Expand Down Expand Up @@ -299,6 +304,7 @@ set(SRCS
src/md5/wrap.c

src/mem/mem.c
src/mem/mem_pool.c
src/mem/secure.c

src/mod/mod.c
Expand Down
8 changes: 4 additions & 4 deletions include/re_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,16 @@ static __forceinline unsigned __int64 _re_atomic_load(

switch (size) {
case 1u:
v = __iso_volatile_load8((const unsigned __int8*)a);
v = __iso_volatile_load8((const volatile __int8*)a);
break;
case 2u:
v = __iso_volatile_load16((const unsigned __int16*)a);
v = __iso_volatile_load16((const volatile __int16*)a);
break;
case 4u:
v = __iso_volatile_load32((const unsigned __int32*)a);
v = __iso_volatile_load32((const volatile __int32*)a);
break;
default:
v = __iso_volatile_load64((const unsigned __int64*)a);
v = __iso_volatile_load64((const volatile __int64*)a);
break;
}

Expand Down
1 change: 1 addition & 0 deletions include/re_http.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ int https_listen(struct http_sock **sockp, const struct sa *laddr,
const char *cert, http_req_h *reqh, void *arg);
int https_set_verify_msgh(struct http_sock *sock,
https_verify_msg_h *verifyh);
void http_set_max_body_size(struct http_sock *sock, size_t limit);
struct tcp_sock *http_sock_tcp(struct http_sock *sock);
struct tls *http_sock_tls(const struct http_sock *conn);
const struct sa *http_conn_peer(const struct http_conn *conn);
Expand Down
1 change: 1 addition & 0 deletions include/re_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void re_thread_async_cancel(intptr_t id);
void re_thread_async_main_cancel(intptr_t id);

void re_set_mutex(void *mutexp);
void re_fhs_flush(void);

struct tmrl *re_tmrl_get(void);

Expand Down
13 changes: 13 additions & 0 deletions include/re_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ int mem_get_stat(struct memstat *mstat);
/* Secure memory functions */
int mem_seccmp(const uint8_t *s1, const uint8_t *s2, size_t n);
void mem_secclean(void *data, size_t size);


/* Mem Pool */
struct mem_pool;
struct mem_pool_entry;
int mem_pool_alloc(struct mem_pool **poolp, size_t nmemb, size_t membsize,
mem_destroy_h *dh);
int mem_pool_extend(struct mem_pool *pool, size_t num);
struct mem_pool_entry *mem_pool_borrow(struct mem_pool *pool);
struct mem_pool_entry *mem_pool_borrow_extend(struct mem_pool *pool);
void *mem_pool_release(struct mem_pool *pool, struct mem_pool_entry *e);
void *mem_pool_member(const struct mem_pool_entry *entry);
void mem_pool_flush(struct mem_pool *pool);
2 changes: 1 addition & 1 deletion mk/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = libre
PROJECT_NUMBER = 3.18.0
PROJECT_NUMBER = 3.19.0
OUTPUT_DIRECTORY = ../re-dox
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
Expand Down
31 changes: 21 additions & 10 deletions rem/aubuf/aubuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

#define AUBUF_DEBUG 0

enum { POOL_FRAMES = 25 };

/** Locked audio-buffer with almost zero-copy */
struct aubuf {
struct list afl;
struct mem_pool *pool;
struct pl *id; /**< Audio buffer Identifier */
mtx_t *lock;
size_t wish_sz;
Expand Down Expand Up @@ -49,13 +51,13 @@ struct frame {
struct le le;
struct mbuf *mb;
struct auframe af;
struct mem_pool_entry *e;
};


static void frame_destructor(void *arg)
static void frame_destructor(void *data)
{
struct frame *f = arg;

struct frame *f = data;
list_unlink(&f->le);
mem_deref(f->mb);
}
Expand All @@ -65,10 +67,10 @@ static void aubuf_destructor(void *arg)
{
struct aubuf *ab = arg;

list_flush(&ab->afl);
mem_deref(ab->lock);
mem_deref(ab->ajb);
mem_deref(ab->id);
mem_deref(ab->pool);
}


Expand Down Expand Up @@ -100,7 +102,7 @@ static void read_auframe(struct aubuf *ab, struct auframe *af)
}

if (!mbuf_get_left(f->mb)) {
mem_deref(f);
mem_pool_release(ab->pool, f->e);
}
else if (af->srate && af->ch && sample_size) {

Expand Down Expand Up @@ -139,6 +141,11 @@ int aubuf_alloc(struct aubuf **abp, size_t min_sz, size_t max_sz)
if (!ab)
return ENOMEM;

err = mem_pool_alloc(&ab->pool, POOL_FRAMES, sizeof(struct frame),
frame_destructor);
if (err)
goto out;

err = mutex_alloc(&ab->lock);
if (err)
goto out;
Expand Down Expand Up @@ -269,10 +276,13 @@ int aubuf_append_auframe(struct aubuf *ab, struct mbuf *mb,
if (!ab || !mb)
return EINVAL;

f = mem_zalloc(sizeof(*f), frame_destructor);
if (!f)
struct mem_pool_entry *e = mem_pool_borrow_extend(ab->pool);
if (!e)
return ENOMEM;

f = mem_pool_member(e);
f->e = e;

f->mb = mem_ref(mb);
if (af)
f->af = *af;
Expand All @@ -299,7 +309,7 @@ int aubuf_append_auframe(struct aubuf *ab, struct mbuf *mb,
f = list_ledata(ab->afl.head);
if (f) {
ab->cur_sz -= mbuf_get_left(f->mb);
mem_deref(f);
mem_pool_release(ab->pool, f->e);
}
}

Expand Down Expand Up @@ -415,7 +425,7 @@ void aubuf_read_auframe(struct aubuf *ab, struct auframe *af)
struct frame *f = list_ledata(ab->afl.head);
if (f) {
ab->cur_sz -= mbuf_get_left(f->mb);
mem_deref(f);
mem_pool_release(ab->pool, f->e);
}
}

Expand Down Expand Up @@ -499,7 +509,8 @@ void aubuf_flush(struct aubuf *ab)

mtx_lock(ab->lock);

list_flush(&ab->afl);
list_clear(&ab->afl);
mem_pool_flush(ab->pool);
ab->fill_sz = ab->wish_sz;
ab->cur_sz = 0;
ab->wr_sz = 0;
Expand Down
4 changes: 4 additions & 0 deletions rem/vid/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void vidframe_init(struct vidframe *vf, enum vidfmt fmt,

vf->size = *sz;
vf->fmt = fmt;
vf->xoffs = 0;
vf->yoffs = 0;
}


Expand Down Expand Up @@ -156,6 +158,8 @@ void vidframe_init_buf(struct vidframe *vf, enum vidfmt fmt,

vf->size = *sz;
vf->fmt = fmt;
vf->xoffs = 0;
vf->yoffs = 0;
}


Expand Down
Loading

0 comments on commit f3f1ad3

Please sign in to comment.