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 Mar 13, 2024
2 parents 49f7ce6 + 45611b9 commit abbb4dd
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/abi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: 'v3.7.0'
ref: 'v3.9.0'
path: old

- uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/clang-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- name: Install clang-tools
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"
sudo apt-get update && sudo apt-get install -y clang-tools-15
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
sudo apt-get update && sudo apt-get install -y clang-tools-17
- name: analyze
run: |
cmake -B build -DCMAKE_C_COMPILER=clang-15
analyze-build-15 --cdb build/compile_commands.json
cmake -B build -DCMAKE_C_COMPILER=clang-17
analyze-build-17 --cdb build/compile_commands.json --status-bugs -v
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ 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.10.0] - 2024-03-06

## What's Changed
* transp: deref qent only if qentp is not set by @maximilianfridrich in https://github.com/baresip/re/pull/1061
* sipsess: fix doxygen comments by @alfredh in https://github.com/baresip/re/pull/1062
* aufile: fix doxygen comment by @alfredh in https://github.com/baresip/re/pull/1063
* ci/codeql: bump action v3 by @sreimers in https://github.com/baresip/re/pull/1064
* misc: text2pcap helpers (RTP/RTCP capturing) by @sreimers in https://github.com/baresip/re/pull/1065
* ci/mingw: bump upload/download-artifact and cache versions by @sreimers in https://github.com/baresip/re/pull/1066
* transp,tls: add TLS client verification by @maximilianfridrich in https://github.com/baresip/re/pull/1059
* fmt/text2pcap: cleanup by @sreimers in https://github.com/baresip/re/pull/1067
* ci/android: cache openssl build by @sreimers in https://github.com/baresip/re/pull/1068
* ci/misc: fix double push/pull runs by @sreimers in https://github.com/baresip/re/pull/1069
* fmt/text2pcap: fix coverity return value warning by @sreimers in https://github.com/baresip/re/pull/1070
* sipsess/listen: improve glare handling by @maximilianfridrich in https://github.com/baresip/re/pull/1071
* conf: add conf_get_i32 by @sreimers in https://github.com/baresip/re/pull/1072


**Full Changelog**: https://github.com/baresip/re/compare/v3.9.0...v3.10.0


## [v3.9.0] - 2024-01-31

## What's Changed
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
cmake_minimum_required(VERSION 3.14)

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

set(PROJECT_SOVERSION 21) # bump if ABI breaks
set(PROJECT_SOVERSION 22) # bump if ABI breaks

# Pre-release identifier, comment out on a release
# Increment for breaking changes (dev2, dev3...)
Expand Down
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
libre (3.10.0) unstable; urgency=medium

* version 3.10.0

-- Christian Spielberger <[email protected]> Wed, 6 Mar 2024 11:40:00 +0100

libre (3.9.0) unstable; urgency=medium

* version 3.9.0

-- Alfred E. Heggestad <[email protected]> Wed, 31 Jan 2024 08:29:02 +0100

libre (3.8.0) unstable; urgency=medium

* version 3.8.0
Expand Down
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.9.0
PROJECT_NUMBER = 3.10.0
OUTPUT_DIRECTORY = ../re-dox
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
Expand Down
2 changes: 1 addition & 1 deletion src/fmt/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int fmt_timestamp_us(struct re_printf *pf, void *arg)
int h, m, s;
uint64_t us;
struct timespec tspec;
struct tm tm;
struct tm tm = {0};

#if defined(WIN32) && !defined(__MINGW32__)
timespec_get(&tspec, TIME_UTC);
Expand Down
48 changes: 23 additions & 25 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <re_fmt.h>
#include <re_net.h>
#include <re_mem.h>
#include <re_mbuf.h>
#include <re_list.h>
#include <re_thread.h>
#include <re_tmr.h>
Expand Down Expand Up @@ -72,6 +71,7 @@ struct re_fhs {
int flags; /**< Polling flags (Read, Write, etc.) */
fd_h* fh; /**< Event handler */
void* arg; /**< Handler argument */
struct re_fhs* next; /**< Next element in the delete list */
};

/** Polling loop data */
Expand All @@ -82,7 +82,7 @@ struct re {
RE_ATOMIC bool polling; /**< Is polling flag */
int sig; /**< Last caught signal */
struct tmrl *tmrl; /**< List of timers */
struct mbuf *fhsld; /**< fhs delete list */
struct re_fhs *fhsld; /**< fhs single-linked delete list */
#ifdef HAVE_SELECT
struct re_fhs **fhsl; /**< Select fhs pointer list */
#endif
Expand Down Expand Up @@ -111,18 +111,14 @@ static void poll_close(struct re *re);

static void fhsld_flush(struct re *re)
{
if (!re->fhsld)
return;

re->fhsld->pos = 0;
struct re_fhs *fhs = re->fhsld;
re->fhsld = NULL;

while (re->fhsld->pos < re->fhsld->end) {
intptr_t p = mbuf_read_ptr(re->fhsld);
mem_deref((void *)p);
while (fhs) {
struct re_fhs *next = fhs->next;
mem_deref(fhs);
fhs = next;
}

re->fhsld->pos = 0;
re->fhsld->end = 0;
}


Expand All @@ -135,7 +131,6 @@ static void re_destructor(void *arg)
mem_deref(re->mutex);
mem_deref(re->async);
mem_deref(re->tmrl);
mem_deref(re->fhsld);
}


Expand Down Expand Up @@ -163,12 +158,6 @@ int re_alloc(struct re **rep)
if (!re)
return ENOMEM;

re->fhsld = mbuf_alloc(64 * sizeof(void *));
if (!re->fhsld) {
err = ENOMEM;
goto out;
}

err = mutex_alloc_tp(&re->mutex, mtx_recursive);

if (err) {
Expand Down Expand Up @@ -722,7 +711,10 @@ struct re_fhs *fd_close(struct re_fhs *fhs)
DEBUG_INFO("fd_close: fd=%d\n", fhs->fd);
}

mbuf_write_ptr(re->fhsld, (intptr_t)fhs);
re_assert(fhs->next == NULL);
fhs->next = re->fhsld;
re->fhsld = fhs;

--re->nfds;

return NULL;
Expand All @@ -741,6 +733,7 @@ static int fd_poll(struct re *re)
const uint64_t to = tmr_next_timeout(re->tmrl);
int i, n;
int nfds = re->nfds;
int err = 0;
struct re_fhs *fhs = NULL;
#ifdef HAVE_SELECT
fd_set rfds, wfds, efds;
Expand Down Expand Up @@ -827,11 +820,14 @@ static int fd_poll(struct re *re)
default:
(void)to;
DEBUG_WARNING("no polling method set\n");
return EINVAL;
err = EINVAL;
goto out;
}

if (n < 0)
return RE_ERRNO_SOCK;
if (n < 0) {
err = RE_ERRNO_SOCK;
goto out;
}

/* Check for events */
for (i=0; (n > 0) && (i < nfds); i++) {
Expand Down Expand Up @@ -908,7 +904,8 @@ static int fd_poll(struct re *re)
#endif

default:
return EINVAL;
err = EINVAL;
goto out;
}

if (!flags)
Expand All @@ -926,10 +923,11 @@ static int fd_poll(struct re *re)
--n;
}

out:
/* Delayed fhs deref to avoid dangling fhs pointers */
fhsld_flush(re);

return 0;
return err;
}


Expand Down
2 changes: 2 additions & 0 deletions src/sip/transp.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,8 @@ static void websock_recv_handler(const struct websock_hdr *hdr,
if (mb->end <= 4)
return;

tmr_start(&conn->tmr, TCP_IDLE_TIMEOUT * 1000, conn_tmr_handler, conn);

start = mb->pos;

err = sip_msg_decode(&msg, mb);
Expand Down
8 changes: 4 additions & 4 deletions test/httpauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,13 +651,13 @@ int test_httpauth_digest_response(void)
goto out;
}

mb_printed = mem_deref (mb_printed);
resp = mem_deref(resp);
mem_deref(mb_printed);
mem_deref(resp);
continue;

out:
mb_printed = mem_deref (mb_printed);
resp = mem_deref(resp);
mem_deref(mb_printed);
mem_deref(resp);
break;
}

Expand Down
6 changes: 3 additions & 3 deletions test/sipsess.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static int make_sdp(struct mbuf **mbp, const char *sdp)
static void send_update_a(void *arg)
{
struct test *test = arg;
struct mbuf *desc;
struct mbuf *desc = NULL;
int err;

err = make_sdp(&desc, sdp_a);
Expand All @@ -223,7 +223,7 @@ static void send_update_a(void *arg)
static void send_update_b(void *arg)
{
struct test *test = arg;
struct mbuf *desc;
struct mbuf *desc = NULL;
int err;

err = make_sdp(&desc, sdp_b);
Expand Down Expand Up @@ -433,7 +433,7 @@ static void close_handler(int err, const struct sip_msg *msg, void *arg)
static void conn_handler(const struct sip_msg *msg, void *arg)
{
struct test *test = arg;
struct mbuf *desc;
struct mbuf *desc = NULL;
int err;
char *hdrs = test->rel100_b == REL100_REQUIRED ?
"Require: 100rel\r\n" : "";
Expand Down

0 comments on commit abbb4dd

Please sign in to comment.