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 Feb 11, 2024
2 parents 079fa11 + b3ea9bb commit e6ea8ab
Show file tree
Hide file tree
Showing 26 changed files with 365 additions and 60 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/abi.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: ABI Checks

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
abicheck:
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Android

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
openssl: 3.2.1

jobs:
android:
Expand All @@ -9,11 +18,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
id: openssl
with:
path: openssl
key: ${{ runner.os }}-android-openssl-${{ env.openssl }}

- name: "build openssl"
if: steps.openssl.outputs.cache-hit != 'true'
run: |
wget -q https://www.openssl.org/source/openssl-3.2.0.tar.gz
tar -xzf openssl-3.2.0.tar.gz
mv openssl-3.2.0 openssl
wget -q https://www.openssl.org/source/openssl-$openssl.tar.gz
tar -xzf openssl-$openssl.tar.gz
mv openssl-$openssl openssl
cd openssl && ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH ./Configure android-arm64 no-shared no-tests -U__ANDROID_API__ -D__ANDROID_API__=21 && PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make build_libs && cd ..
- name: build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: cpp
queries: security-extended
Expand All @@ -34,5 +34,5 @@ jobs:
cmake -B build && cmake --build build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

8 changes: 7 additions & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: iOS

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ios:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: lint

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: MinGW-w64 Test

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
MinGW-w64-build:
Expand Down Expand Up @@ -32,7 +38,7 @@ jobs:
with:
path: baresip-win32/re

- uses: actions/cache@v2
- uses: actions/cache@v4
id: openssl
with:
path: baresip-win32/openssl
Expand All @@ -50,7 +56,7 @@ jobs:
run: |
cd baresip-win32 && make retest
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: retest-exe
path: baresip-win32/re/build/test/retest.exe
Expand All @@ -62,7 +68,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
- uses: sreimers/[email protected]
with:
name: re
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/run-on-arch.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build_job:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ssl.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: OpenSSL no-deprecated and LibreSSL

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ssl:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: valgrind leak check

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
valgrind:
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,39 @@ 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.9.0] - 2024-01-31

## What's Changed
* http: fix doxygen by @cspiel1 in https://github.com/baresip/re/pull/1033
* types: remove old ARRAY_SIZE macro by @alfredh in https://github.com/baresip/re/pull/1034
* cmake: bump minimum to version 3.14 by @alfredh in https://github.com/baresip/re/pull/1030
* test: use re_is_aligned() by @alfredh in https://github.com/baresip/re/pull/1035
* sipsess: refactor and simplify SDP negotiation state by @maximilianfridrich in https://github.com/baresip/re/pull/1016
* bump year by @sreimers in https://github.com/baresip/re/pull/1038
* cmake,pc: fix static library build by @alfredh in https://github.com/baresip/re/pull/1036
* rx thread activate by @cspiel1 in https://github.com/baresip/re/pull/1037
* test: fix cppcheck warnings by @alfredh in https://github.com/baresip/re/pull/1040
* test: move test_rtcp_decode_badmsg() to separate testcase by @alfredh in https://github.com/baresip/re/pull/1041
* rtp: lock more fields from rtcp_sess by @cspiel1 in https://github.com/baresip/re/pull/1039
* rtp: lock rtcp_set_srate() by @cspiel1 in https://github.com/baresip/re/pull/1043
* test: HAVE_INET6 is always defined by @alfredh in https://github.com/baresip/re/pull/1046
* ci: add run-on-arch for ARM64 linux by @alfredh in https://github.com/baresip/re/pull/1045
* httpauth: digest verification rfc 7616 by @cHuberCoffee in https://github.com/baresip/re/pull/1044
* tmr: prevent race condition on cancel by @sreimers in https://github.com/baresip/re/pull/1048
* aubuf: fix coverity defect by @alfredh in https://github.com/baresip/re/pull/1051
* btrace: fix coverity warning by @alfredh in https://github.com/baresip/re/pull/1049
* ci/win: downgrade openssl by @sreimers in https://github.com/baresip/re/pull/1054
* docs: update README by @alfredh in https://github.com/baresip/re/pull/1053
* http: client - set scopeid fixes HTTP requests for IPv6ll by @cspiel1 in https://github.com/baresip/re/pull/1055
* rtp: add rtp_source_ prefix to RTP source api by @alfredh in https://github.com/baresip/re/pull/1052
* rtp: make struct rtp_source public by @alfredh in https://github.com/baresip/re/pull/1057
* rtp: sess - fix coverity warning by @cspiel1 in https://github.com/baresip/re/pull/1058
* mk: bump version to 3.9.0 by @alfredh in https://github.com/baresip/re/pull/1060


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


## [v3.8.0] - 2023-12-27

## What's Changed
Expand Down
5 changes: 3 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.8.0
VERSION 3.9.0
LANGUAGES C
HOMEPAGE_URL https://github.com/baresip/re
DESCRIPTION "Generic library for real-time communications"
)

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

# Pre-release identifier, comment out on a release
# Increment for breaking changes (dev2, dev3...)
Expand Down Expand Up @@ -242,6 +242,7 @@ set(SRCS
src/fmt/regex.c
src/fmt/str.c
src/fmt/str_error.c
src/fmt/text2pcap.c
src/fmt/time.c
src/fmt/unicode.c

Expand Down
19 changes: 16 additions & 3 deletions include/re_fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ static inline bool str_isset(const char *s)


/* time */
int fmt_gmtime(struct re_printf *pf, void *ts);
int fmt_timestamp(struct re_printf *pf, void *ts);
int fmt_human_time(struct re_printf *pf, const uint32_t *seconds);
int fmt_gmtime(struct re_printf *pf, void *ts);
int fmt_timestamp(struct re_printf *pf, void *ts);
int fmt_timestamp_us(struct re_printf *pf, void *arg);
int fmt_human_time(struct re_printf *pf, const uint32_t *seconds);


void hexdump(FILE *f, const void *p, size_t len);
Expand All @@ -202,3 +203,15 @@ void fmt_param_apply(const struct pl *pl, fmt_param_h *ph, void *arg);
int utf8_encode(struct re_printf *pf, const char *str);
int utf8_decode(struct re_printf *pf, const struct pl *pl);
size_t utf8_byteseq(char u[4], unsigned cp);


/* text2pcap */
struct re_text2pcap {
bool in;
const struct mbuf *mb;
const char *id;
};

int re_text2pcap(struct re_printf *pf, struct re_text2pcap *pcap);
void re_text2pcap_trace(const char *name, const char *id, bool in,
const struct mbuf *mb);
10 changes: 5 additions & 5 deletions include/re_sipsess.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
struct sipsess_sock;
struct sipsess;

/* SDP Negotiation state */
/** SDP Negotiation state */
enum sdp_neg_state {
SDP_NEG_NONE = 0,
SDP_NEG_LOCAL_OFFER, /** SDP offer sent */
SDP_NEG_REMOTE_OFFER, /** SDP offer received */
SDP_NEG_PREVIEW_ANSWER, /** SDP preview answer sent */
SDP_NEG_DONE /** SDP negotiation done */
SDP_NEG_LOCAL_OFFER, /**< SDP offer sent */
SDP_NEG_REMOTE_OFFER, /**< SDP offer received */
SDP_NEG_PREVIEW_ANSWER, /**< SDP preview answer sent */
SDP_NEG_DONE /**< SDP negotiation done */
};


Expand Down
2 changes: 2 additions & 0 deletions include/re_tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ int tls_srtp_keyinfo(const struct tls_conn *tc, enum srtp_suite *suite,
const char *tls_cipher_name(const struct tls_conn *tc);
int tls_set_ciphers(struct tls *tls, const char *cipherv[], size_t count);
int tls_set_verify_server(struct tls_conn *tc, const char *host);
int tls_verify_client(struct tls_conn *tc);

int tls_get_issuer(struct tls *tls, struct mbuf *mb);
int tls_get_subject(struct tls *tls, struct mbuf *mb);
void tls_disable_verify_server(struct tls *tls);
void tls_enable_verify_client(struct tls *tls, bool enable);

int tls_set_min_proto_version(struct tls *tls, int version);
int tls_set_max_proto_version(struct tls *tls, int version);
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.8.0
PROJECT_NUMBER = 3.9.0
OUTPUT_DIRECTORY = ../re-dox
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
Expand Down
1 change: 1 addition & 0 deletions rem/aufile/aufile.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ size_t aufile_get_length(struct aufile *af, const struct aufile_prm *prm)
*
* @param af Audio-file
* @param prm Audio file parameters from aufile_open
* @param pos_ms Playing position in milliseconds
*
* @return 0 if success, otherwise errorcode
*/
Expand Down
47 changes: 47 additions & 0 deletions src/fmt/text2pcap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <re_types.h>
#include <re_fmt.h>
#include <re_mbuf.h>
#include <re_trace.h>
#include <re_mem.h>


int re_text2pcap(struct re_printf *pf, struct re_text2pcap *pcap)
{
if (!pcap)
return EINVAL;

uint8_t *buf = mbuf_buf(pcap->mb);
if (!buf)
return EINVAL;

re_hprintf(pf, "%s %H 000000", pcap->in ? "I" : "O", fmt_timestamp_us,
NULL);

size_t sz = mbuf_get_left(pcap->mb);
for (size_t i = 0; i < sz; i++) {
re_hprintf(pf, " %02x", buf[i]);
}

re_hprintf(pf, " %s", pcap->id);

return 0;
}


void re_text2pcap_trace(const char *name, const char *id, bool in,
const struct mbuf *mb)
{
struct re_text2pcap pcap = {.in = in, .mb = mb, .id = id};
size_t pcap_buf_sz = (mbuf_get_left(mb) * 3) + 64;

char *pcap_buf = mem_alloc(pcap_buf_sz, NULL);
if (!pcap_buf)
return;

re_snprintf(pcap_buf, pcap_buf_sz, "%H", re_text2pcap, &pcap);

re_trace_event("pcap", name, 'I', NULL, RE_TRACE_ARG_STRING_COPY,
"pcap", pcap_buf);

mem_deref(pcap_buf);
}
Loading

0 comments on commit e6ea8ab

Please sign in to comment.