summaryrefslogtreecommitdiff
path: root/net-libs/pjproject
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-13 01:41:21 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-13 01:41:21 +0100
commitb89a664f266dab3b9b5ddac2cb874f8869142370 (patch)
tree21d127b0b99c1505ba548bc05975b9fcecda871e /net-libs/pjproject
parent7e662ec84fc13cef513542e4030f47017d030187 (diff)
gentoo auto-resync : 13:10:2022 - 01:41:21
Diffstat (limited to 'net-libs/pjproject')
-rw-r--r--net-libs/pjproject/Manifest5
-rw-r--r--net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39244.patch306
-rw-r--r--net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39269.patch33
-rw-r--r--net-libs/pjproject/files/pjproject-2.12.1-r2-bashism.patch44
-rw-r--r--net-libs/pjproject/files/pjproject-2.12.1-r2-musl.patch102
-rw-r--r--net-libs/pjproject/pjproject-2.12.1-r2.ebuild144
6 files changed, 634 insertions, 0 deletions
diff --git a/net-libs/pjproject/Manifest b/net-libs/pjproject/Manifest
index bd2375c51861..f33f5bce205b 100644
--- a/net-libs/pjproject/Manifest
+++ b/net-libs/pjproject/Manifest
@@ -1,5 +1,10 @@
AUX pjproject-2.12.1-CVE-2022-31031.patch 1408 BLAKE2B 7a541dc0e0e9508374084121a81e258a19d4e050232c47cc5be67b8115da0fffb96de6e17a311a53e137ed5313109b2ac9513ff85bb17f3ecf7e066160c9019f SHA512 c6bb01cb3a50399075b264be7fb5f20f58c269cf6a71082e76865eda6393d6f546ddf4e09367e354db90b5064ea9ffd61e1783ad988e222eaccb523d90cda16b
AUX pjproject-2.12.1-config_site.h 3213 BLAKE2B f7e4d26e83591071b8527417a0a2cf4970efff6789bff22df643ce5c350d249973cf830266a6710b3000d46c3638fe5000008efb1fea8fa6d83521cf109fcc21 SHA512 058dbe06adee83f3e288950af8776012e07181aec969f7d0a6104b63f7b3168d4db4a8e18c7f6170b12ec51ce22d4fe0074fd000682bc71a9251937b77f6ea51
+AUX pjproject-2.12.1-r2-CVE-2022-39244.patch 9936 BLAKE2B b9be3feb439421f82ff6609e5b51c38cb9fd407b869e1d2b11d85994bf71ec7c04614b215b5e577395227c9c43a64e524e102e962bfd6996e6956368b01e0ca5 SHA512 ffcd681b5a4d035c432b0c7c61d6dc16206d36ea5fcd5aa89bb6439999e9f78ffd92a4f9aa3b6ce199407c43120a38c516c4327f8edcb7dd7c35ee032a844ad8
+AUX pjproject-2.12.1-r2-CVE-2022-39269.patch 1157 BLAKE2B 57a6e5d63c814663b49a0c1c0ec89b3c0fd63c1fda7a1ea4506e68d2b2e0ff84d2d9114379b2e5e260c411e4cca129dcd21d0457ee51a3466c04795916ac3167 SHA512 9557b9d942377a9a03866c0faeb66931a39e9a2506969db5874106f97b8bec68c8ab772364eab9c521b628e11778c35acb676052004927a82d3aa4edd163af49
+AUX pjproject-2.12.1-r2-bashism.patch 1658 BLAKE2B 52498d58f953ca6ca04a3fb4f013fea98b6f49530c7d25dd792d539d3b19eedd2a612900b6b6c8910c10a8004d13bc394716f103146f4bf60ad7ce8f785fdeb8 SHA512 5448766025f13e7f540af770082663d74d189f2cf436caa31222fe9b40d9a90c51cb91297f4e169531fba391c706065c407e9bc3633cd56d81536b6c9ded4d9b
+AUX pjproject-2.12.1-r2-musl.patch 2941 BLAKE2B 58eab3d88a503e36fd1dee26593805e0ec487fc50a41fbc68e6d489895920a15f671ad7d28257d158eda9c2253826fe9e2f9c115b644028191821abdc9aa035d SHA512 26b51b7b5bdd93b40ff267bea1c213f7417acaaab233ffcedaba948c509471210b53eea03c536056afe9298753644b6108d5cf88cf49d8e16e23309967e374ec
DIST pjproject-2.12.1.tar.gz 9660659 BLAKE2B d893f22d995c9570e4003f80adf15144cf39e09d5843a88e3a616a529a91164ec7b012ea66ede8d55bfe4ec0dc4eca7d230f07fc66f06dfafaea9d5ff72910fa SHA512 9087456024b8886e56660cebc45c7093b3b91cd6b08a3926fa2c0de452989ac84ceb4e27413c0311bde95f271341ee44d9681f81f83602a4e16151f1831d773b
EBUILD pjproject-2.12.1-r1.ebuild 3775 BLAKE2B 9a868494def81d6a7c0bfd16ab31b606db66d79a945b08a76370fd45ca21e745f72bba6c5316ab0cc7dbfc6c060e76949fc188fbe5371171644388262fc0aa95 SHA512 ba406e659cfcf2dffd04c2bda54d37d4409561040c9349edb6ac8c990304d1e5fa59bf7c4864f2e8d04b0e2252525450c59177c3bcfbf52c44b2977e6d675146
+EBUILD pjproject-2.12.1-r2.ebuild 4020 BLAKE2B 31edf5fb08daeed7cf6aea17be6eb82b0d65d398ffeb92e1e9c8df11b4ef2f337ec3d71f5135ea6f121553866fe60ae00f7f7173c631d131db9900b6c5221cec SHA512 021cf3fa946fc62f598dacbb52a9d3f39b0644817c189809bc0ae1c6b45f52087d7d293cdfa009d67e14dd9b8389810b0075b85e2df71d42005990b404aec971
MISC metadata.xml 1459 BLAKE2B e35f9c8621ea7c1c2670d90f69c341b53b20501ece6fcb41fefdec9f328a6c2b88f2f9d2fd2a77938b802fc74c36f2e3387cad3be7c9126767f28d32b42d19ed SHA512 498a94fb2bf3692b60c644e9d3e341761b20e8a4e0215e1c14c4444a199f9abb085f3421e143e7b944bac54a4f774c0b47af76c6fae5fc2cda4da13d1781a9b0
diff --git a/net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39244.patch b/net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39244.patch
new file mode 100644
index 000000000000..a0995fb92957
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39244.patch
@@ -0,0 +1,306 @@
+https://bugs.gentoo.org/875863
+https://github.com/pjsip/pjproject/commit/c4d34984ec92b3d5252a7d5cddd85a1d3a8001ae
+
+From c4d34984ec92b3d5252a7d5cddd85a1d3a8001ae Mon Sep 17 00:00:00 2001
+From: sauwming <ming@teluu.com>
+Date: Mon, 3 Oct 2022 08:07:22 +0800
+Subject: [PATCH] Merge pull request from GHSA-fq45-m3f7-3mhj
+
+* Initial patch
+
+* Use 'pj_scan_is_eof(scanner)'
+
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+
+* Use 'pj_scan_is_eof(scanner)'
+
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+
+* Use 'pj_scan_is_eof(scanner)'
+
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+
+* Use `!pj_scan_is_eof` instead of manually checking `scanner->curptr < scanner->end`
+
+Co-authored-by: Maksim Mukosey <mmukosey@gmail.com>
+
+* Update pjlib-util/src/pjlib-util/scanner.c
+
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+
+* Update pjlib-util/src/pjlib-util/scanner.c
+
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+
+* Update pjlib-util/src/pjlib-util/scanner.c
+
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+
+* Revert '>=' back to '>' in pj_scan_stricmp_alnum()
+
+* Fix error compiles.
+
+Co-authored-by: Nanang Izzuddin <nanang@teluu.com>
+Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com>
+Co-authored-by: Maksim Mukosey <mmukosey@gmail.com>
+---
+ pjlib-util/src/pjlib-util/scanner.c | 41 +++++++++++++++++++----------
+ pjmedia/src/pjmedia/rtp.c | 11 +++++---
+ pjmedia/src/pjmedia/sdp.c | 24 ++++++++++-------
+ 3 files changed, 48 insertions(+), 28 deletions(-)
+
+diff --git a/pjlib-util/src/pjlib-util/scanner.c b/pjlib-util/src/pjlib-util/scanner.c
+index a54edf2d8e..6541bbae31 100644
+--- a/pjlib-util/src/pjlib-util/scanner.c
++++ b/pjlib-util/src/pjlib-util/scanner.c
+@@ -195,7 +195,13 @@ PJ_DEF(void) pj_scan_skip_whitespace( pj_scanner *scanner )
+
+ PJ_DEF(void) pj_scan_skip_line( pj_scanner *scanner )
+ {
+- char *s = pj_memchr(scanner->curptr, '\n', scanner->end - scanner->curptr);
++ char *s;
++
++ if (pj_scan_is_eof(scanner)) {
++ return;
++ }
++
++ s = pj_memchr(scanner->curptr, '\n', scanner->end - scanner->curptr);
+ if (!s) {
+ scanner->curptr = scanner->end;
+ } else {
+@@ -264,8 +270,7 @@ PJ_DEF(void) pj_scan_get( pj_scanner *scanner,
+
+ pj_assert(pj_cis_match(spec,0)==0);
+
+- /* EOF is detected implicitly */
+- if (!pj_cis_match(spec, *s)) {
++ if (pj_scan_is_eof(scanner) || !pj_cis_match(spec, *s)) {
+ pj_scan_syntax_err(scanner);
+ return;
+ }
+@@ -299,8 +304,7 @@ PJ_DEF(void) pj_scan_get_unescape( pj_scanner *scanner,
+ /* Must not match character '%' */
+ pj_assert(pj_cis_match(spec,'%')==0);
+
+- /* EOF is detected implicitly */
+- if (!pj_cis_match(spec, *s) && *s != '%') {
++ if (pj_scan_is_eof(scanner) || !pj_cis_match(spec, *s) && *s != '%') {
+ pj_scan_syntax_err(scanner);
+ return;
+ }
+@@ -436,7 +440,9 @@ PJ_DEF(void) pj_scan_get_n( pj_scanner *scanner,
+
+ scanner->curptr += N;
+
+- if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) {
++ if (!pj_scan_is_eof(scanner) &&
++ PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws)
++ {
+ pj_scan_skip_whitespace(scanner);
+ }
+ }
+@@ -467,15 +473,16 @@ PJ_DEF(int) pj_scan_get_char( pj_scanner *scanner )
+
+ PJ_DEF(void) pj_scan_get_newline( pj_scanner *scanner )
+ {
+- if (!PJ_SCAN_IS_NEWLINE(*scanner->curptr)) {
++ if (pj_scan_is_eof(scanner) || !PJ_SCAN_IS_NEWLINE(*scanner->curptr)) {
+ pj_scan_syntax_err(scanner);
+ return;
+ }
+
++ /* We have checked scanner->curptr validity above */
+ if (*scanner->curptr == '\r') {
+ ++scanner->curptr;
+ }
+- if (*scanner->curptr == '\n') {
++ if (!pj_scan_is_eof(scanner) && *scanner->curptr == '\n') {
+ ++scanner->curptr;
+ }
+
+@@ -520,7 +527,9 @@ PJ_DEF(void) pj_scan_get_until( pj_scanner *scanner,
+
+ scanner->curptr = s;
+
+- if (PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws) {
++ if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
++ scanner->skip_ws)
++ {
+ pj_scan_skip_whitespace(scanner);
+ }
+ }
+@@ -544,7 +553,9 @@ PJ_DEF(void) pj_scan_get_until_ch( pj_scanner *scanner,
+
+ scanner->curptr = s;
+
+- if (PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws) {
++ if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
++ scanner->skip_ws)
++ {
+ pj_scan_skip_whitespace(scanner);
+ }
+ }
+@@ -570,7 +581,9 @@ PJ_DEF(void) pj_scan_get_until_chr( pj_scanner *scanner,
+
+ scanner->curptr = s;
+
+- if (PJ_SCAN_IS_PROBABLY_SPACE(*s) && scanner->skip_ws) {
++ if (!pj_scan_is_eof(scanner) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
++ scanner->skip_ws)
++ {
+ pj_scan_skip_whitespace(scanner);
+ }
+ }
+@@ -585,7 +598,9 @@ PJ_DEF(void) pj_scan_advance_n( pj_scanner *scanner,
+
+ scanner->curptr += N;
+
+- if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && skip_ws) {
++ if (!pj_scan_is_eof(scanner) &&
++ PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && skip_ws)
++ {
+ pj_scan_skip_whitespace(scanner);
+ }
+ }
+@@ -636,5 +651,3 @@ PJ_DEF(void) pj_scan_restore_state( pj_scanner *scanner,
+ scanner->line = state->line;
+ scanner->start_line = state->start_line;
+ }
+-
+-
+diff --git a/pjmedia/src/pjmedia/rtp.c b/pjmedia/src/pjmedia/rtp.c
+index 18917f18b5..d29348cc5f 100644
+--- a/pjmedia/src/pjmedia/rtp.c
++++ b/pjmedia/src/pjmedia/rtp.c
+@@ -188,6 +188,11 @@ PJ_DEF(pj_status_t) pjmedia_rtp_decode_rtp2(
+ /* Payload is located right after header plus CSRC */
+ offset = sizeof(pjmedia_rtp_hdr) + ((*hdr)->cc * sizeof(pj_uint32_t));
+
++ /* Check that offset is less than packet size */
++ if (offset >= pkt_len) {
++ return PJMEDIA_RTP_EINLEN;
++ }
++
+ /* Decode RTP extension. */
+ if ((*hdr)->x) {
+ if (offset + sizeof (pjmedia_rtp_ext_hdr) > (unsigned)pkt_len)
+@@ -202,8 +207,8 @@ PJ_DEF(pj_status_t) pjmedia_rtp_decode_rtp2(
+ dec_hdr->ext_len = 0;
+ }
+
+- /* Check that offset is less than packet size */
+- if (offset > pkt_len)
++ /* Check again that offset is still less than packet size */
++ if (offset >= pkt_len)
+ return PJMEDIA_RTP_EINLEN;
+
+ /* Find and set payload. */
+@@ -393,5 +398,3 @@ void pjmedia_rtp_seq_update( pjmedia_rtp_seq_session *sess,
+ seq_status->status.value = st.status.value;
+ }
+ }
+-
+-
+diff --git a/pjmedia/src/pjmedia/sdp.c b/pjmedia/src/pjmedia/sdp.c
+index 3905c2f525..647f49e138 100644
+--- a/pjmedia/src/pjmedia/sdp.c
++++ b/pjmedia/src/pjmedia/sdp.c
+@@ -983,13 +983,13 @@ static void parse_version(pj_scanner *scanner,
+ ctx->last_error = PJMEDIA_SDP_EINVER;
+
+ /* check equal sign */
+- if (*(scanner->curptr+1) != '=') {
++ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
+ on_scanner_error(scanner);
+ return;
+ }
+
+ /* check version is 0 */
+- if (*(scanner->curptr+2) != '0') {
++ if (scanner->curptr+2 >= scanner->end || *(scanner->curptr+2) != '0') {
+ on_scanner_error(scanner);
+ return;
+ }
+@@ -1006,7 +1006,7 @@ static void parse_origin(pj_scanner *scanner, pjmedia_sdp_session *ses,
+ ctx->last_error = PJMEDIA_SDP_EINORIGIN;
+
+ /* check equal sign */
+- if (*(scanner->curptr+1) != '=') {
++ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
+ on_scanner_error(scanner);
+ return;
+ }
+@@ -1052,7 +1052,7 @@ static void parse_time(pj_scanner *scanner, pjmedia_sdp_session *ses,
+ ctx->last_error = PJMEDIA_SDP_EINTIME;
+
+ /* check equal sign */
+- if (*(scanner->curptr+1) != '=') {
++ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
+ on_scanner_error(scanner);
+ return;
+ }
+@@ -1080,7 +1080,7 @@ static void parse_generic_line(pj_scanner *scanner, pj_str_t *str,
+ ctx->last_error = PJMEDIA_SDP_EINSDP;
+
+ /* check equal sign */
+- if (*(scanner->curptr+1) != '=') {
++ if ((scanner->curptr+1 >= scanner->end) || *(scanner->curptr+1) != '=') {
+ on_scanner_error(scanner);
+ return;
+ }
+@@ -1149,7 +1149,7 @@ static void parse_media(pj_scanner *scanner, pjmedia_sdp_media *med,
+ ctx->last_error = PJMEDIA_SDP_EINMEDIA;
+
+ /* check the equal sign */
+- if (*(scanner->curptr+1) != '=') {
++ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
+ on_scanner_error(scanner);
+ return;
+ }
+@@ -1164,6 +1164,10 @@ static void parse_media(pj_scanner *scanner, pjmedia_sdp_media *med,
+ /* port */
+ pj_scan_get(scanner, &cs_token, &str);
+ med->desc.port = (unsigned short)pj_strtoul(&str);
++ if (pj_scan_is_eof(scanner)) {
++ on_scanner_error(scanner);
++ return;
++ }
+ if (*scanner->curptr == '/') {
+ /* port count */
+ pj_scan_get_char(scanner);
+@@ -1175,7 +1179,7 @@ static void parse_media(pj_scanner *scanner, pjmedia_sdp_media *med,
+ }
+
+ if (pj_scan_get_char(scanner) != ' ') {
+- PJ_THROW(SYNTAX_ERROR);
++ on_scanner_error(scanner);
+ }
+
+ /* transport */
+@@ -1183,7 +1187,7 @@ static void parse_media(pj_scanner *scanner, pjmedia_sdp_media *med,
+
+ /* format list */
+ med->desc.fmt_count = 0;
+- while (*scanner->curptr == ' ') {
++ while (scanner->curptr < scanner->end && *scanner->curptr == ' ') {
+ pj_str_t fmt;
+
+ pj_scan_get_char(scanner);
+@@ -1223,7 +1227,7 @@ static pjmedia_sdp_attr *parse_attr( pj_pool_t *pool, pj_scanner *scanner,
+ attr = PJ_POOL_ALLOC_T(pool, pjmedia_sdp_attr);
+
+ /* check equal sign */
+- if (*(scanner->curptr+1) != '=') {
++ if (scanner->curptr+1 >= scanner->end || *(scanner->curptr+1) != '=') {
+ on_scanner_error(scanner);
+ return NULL;
+ }
+@@ -1242,7 +1246,7 @@ static pjmedia_sdp_attr *parse_attr( pj_pool_t *pool, pj_scanner *scanner,
+ pj_scan_get_char(scanner);
+
+ /* get value */
+- if (*scanner->curptr != '\r' && *scanner->curptr != '\n') {
++ if (!pj_scan_is_eof(scanner) && *scanner->curptr != '\r' && *scanner->curptr != '\n') {
+ pj_scan_get_until_chr(scanner, "\r\n", &attr->value);
+ } else {
+ attr->value.ptr = NULL;
diff --git a/net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39269.patch b/net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39269.patch
new file mode 100644
index 000000000000..7c065a024b92
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.12.1-r2-CVE-2022-39269.patch
@@ -0,0 +1,33 @@
+https://bugs.gentoo.org/875863
+https://github.com/pjsip/pjproject/commit/d2acb9af4e27b5ba75d658690406cec9c274c5cc
+
+From d2acb9af4e27b5ba75d658690406cec9c274c5cc Mon Sep 17 00:00:00 2001
+From: Riza Sulistyo <trengginas@users.noreply.github.com>
+Date: Thu, 6 Oct 2022 13:55:13 +0700
+Subject: [PATCH] Merge pull request from GHSA-wx5m-cj97-4wwg
+
+---
+ pjmedia/src/pjmedia/transport_srtp.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/pjmedia/src/pjmedia/transport_srtp.c b/pjmedia/src/pjmedia/transport_srtp.c
+index 2d393beaa..39d06434b 100644
+--- a/pjmedia/src/pjmedia/transport_srtp.c
++++ b/pjmedia/src/pjmedia/transport_srtp.c
+@@ -1531,13 +1531,14 @@ static void srtp_rtp_cb(pjmedia_tp_cb_param *param)
+ pjmedia_srtp_crypto tx, rx;
+ pj_status_t status;
+
++ tx = srtp->tx_policy;
++ rx = srtp->rx_policy;
++
+ /* Stop SRTP first, otherwise srtp_start() will maintain current
+ * roll-over counter.
+ */
+ pjmedia_transport_srtp_stop((pjmedia_transport*)srtp);
+
+- tx = srtp->tx_policy;
+- rx = srtp->rx_policy;
+ status = pjmedia_transport_srtp_start((pjmedia_transport*)srtp,
+ &tx, &rx);
+ if (status != PJ_SUCCESS) {
diff --git a/net-libs/pjproject/files/pjproject-2.12.1-r2-bashism.patch b/net-libs/pjproject/files/pjproject-2.12.1-r2-bashism.patch
new file mode 100644
index 000000000000..d24243eba223
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.12.1-r2-bashism.patch
@@ -0,0 +1,44 @@
+https://bugs.gentoo.org/865719
+https://github.com/pjsip/pjproject/pull/3220
+https://github.com/pjsip/pjproject/commit/bae7e5f4ff9047170e7e160ab52f6d9993aeae80
+
+From 84c7a5a6a050fcd51c7f5cada51df27ab00b7332 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Fri, 19 Aug 2022 11:20:10 +0200
+Subject: [PATCH] aconfigure: fix bashism.
+
+${var//string/replacement} is considered a bashism and should be avoided
+in configure scripts.
+
+Signed-off-by: Jaco Kroon <jaco@uls.co.za>
+---
+ aconfigure | 2 +-
+ aconfigure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/aconfigure b/aconfigure
+index b15c133e2e..5ce01f5057 100755
+--- a/aconfigure
++++ b/aconfigure
+@@ -7986,7 +7986,7 @@ printf "%s\n" "not found" >&6; }
+ ac_sdl_cflags=`$SDL_CONFIG --cflags`
+ ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
+ ac_sdl_ldflags=`$SDL_CONFIG --libs`
+- ac_sdl_ldflags=${ac_sdl_ldflags//-mwindows/}
++ ac_sdl_ldflags=`echo "${ac_sdl_ldflags}" | sed -e 's/-mwindows//g'`
+ LIBS="$LIBS $ac_sdl_ldflags"
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Unsupported SDL version" >&5
+diff --git a/aconfigure.ac b/aconfigure.ac
+index 9fc32d0bf9..2b6227711e 100644
+--- a/aconfigure.ac
++++ b/aconfigure.ac
+@@ -1295,7 +1295,7 @@ AC_ARG_ENABLE(sdl,
+ ac_sdl_cflags=`$SDL_CONFIG --cflags`
+ ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
+ ac_sdl_ldflags=`$SDL_CONFIG --libs`
+- ac_sdl_ldflags=${ac_sdl_ldflags//-mwindows/}
++ ac_sdl_ldflags=`echo "${ac_sdl_ldflags}" | sed -e 's/-mwindows//g'`
+ LIBS="$LIBS $ac_sdl_ldflags"
+ else
+ AC_MSG_RESULT([Unsupported SDL version])
diff --git a/net-libs/pjproject/files/pjproject-2.12.1-r2-musl.patch b/net-libs/pjproject/files/pjproject-2.12.1-r2-musl.patch
new file mode 100644
index 000000000000..8db401dc7544
--- /dev/null
+++ b/net-libs/pjproject/files/pjproject-2.12.1-r2-musl.patch
@@ -0,0 +1,102 @@
+From aa54bd7ae0d60461cb5f434da1338faf315314f6 Mon Sep 17 00:00:00 2001
+From: orbea <orbea@riseup.net>
+Date: Sun, 9 Oct 2022 23:17:34 -0700
+Subject: [PATCH] Fix the build with musl
+
+The execinfo.h header is GNU specific and is not available with musl.
+
+This commit is based on a patch from Alpine Linux.
+
+https://git.alpinelinux.org/aports/tree/main/pjproject/execinfo.patch?h=3.16-stable
+
+Gentoo Issue: https://bugs.gentoo.org/867343
+---
+ pjlib-util/src/pjlib-util-test/main.c | 2 +-
+ pjlib/src/pjlib-test/main.c | 2 +-
+ pjmedia/src/test/main.c | 2 +-
+ pjnath/src/pjnath-test/main.c | 2 +-
+ pjsip-apps/src/pjsua/main.c | 2 +-
+ pjsip/src/test/main.c | 2 +-
+ 6 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/pjlib-util/src/pjlib-util-test/main.c b/pjlib-util/src/pjlib-util-test/main.c
+index 4aeb3e07d..780db4d33 100644
+--- a/pjlib-util/src/pjlib-util-test/main.c
++++ b/pjlib-util/src/pjlib-util-test/main.c
+@@ -33,7 +33,7 @@ static void init_signals()
+ sigaction(SIGALRM, &act, NULL);
+ }
+
+-#elif PJ_LINUX || PJ_DARWINOS
++#elif __GLIBC__ || PJ_DARWINOS
+
+ #include <execinfo.h>
+ #include <signal.h>
+diff --git a/pjlib/src/pjlib-test/main.c b/pjlib/src/pjlib-test/main.c
+index d5f853a60..76a077037 100644
+--- a/pjlib/src/pjlib-test/main.c
++++ b/pjlib/src/pjlib-test/main.c
+@@ -54,7 +54,7 @@ static void init_signals()
+ sigaction(SIGALRM, &act, NULL);
+ }
+
+-#elif PJ_LINUX || PJ_DARWINOS
++#elif __GLIBC__ || PJ_DARWINOS
+
+ #include <execinfo.h>
+ #include <signal.h>
+diff --git a/pjmedia/src/test/main.c b/pjmedia/src/test/main.c
+index 8d6353b15..b16023761 100644
+--- a/pjmedia/src/test/main.c
++++ b/pjmedia/src/test/main.c
+@@ -32,7 +32,7 @@
+ #endif
+
+
+-#if PJ_LINUX || PJ_DARWINOS
++#if __GLIBC__ || PJ_DARWINOS
+
+ #include <execinfo.h>
+ #include <signal.h>
+diff --git a/pjnath/src/pjnath-test/main.c b/pjnath/src/pjnath-test/main.c
+index d783669e5..f6c906166 100644
+--- a/pjnath/src/pjnath-test/main.c
++++ b/pjnath/src/pjnath-test/main.c
+@@ -32,7 +32,7 @@ static void init_signals()
+ sigaction(SIGALRM, &act, NULL);
+ }
+
+-#elif PJ_LINUX || PJ_DARWINOS
++#elif __GLIBC__ || PJ_DARWINOS
+
+ #include <execinfo.h>
+ #include <signal.h>
+diff --git a/pjsip-apps/src/pjsua/main.c b/pjsip-apps/src/pjsua/main.c
+index bb8ddc345..fcc1e8f34 100644
+--- a/pjsip-apps/src/pjsua/main.c
++++ b/pjsip-apps/src/pjsua/main.c
+@@ -80,7 +80,7 @@ static void setup_signal_handler(void)
+ SetConsoleCtrlHandler(&CtrlHandler, TRUE);
+ }
+
+-#elif PJ_LINUX || PJ_DARWINOS
++#elif __GLIBC__ || PJ_DARWINOS
+
+ #include <execinfo.h>
+ #include <signal.h>
+diff --git a/pjsip/src/test/main.c b/pjsip/src/test/main.c
+index 18e4c9255..255667dda 100644
+--- a/pjsip/src/test/main.c
++++ b/pjsip/src/test/main.c
+@@ -36,7 +36,7 @@ static void usage(void)
+ list_tests();
+ }
+
+-#if PJ_LINUX || PJ_DARWINOS
++#if __GLIBC__ || PJ_DARWINOS
+
+ #include <execinfo.h>
+ #include <signal.h>
+--
+2.35.1
+
diff --git a/net-libs/pjproject/pjproject-2.12.1-r2.ebuild b/net-libs/pjproject/pjproject-2.12.1-r2.ebuild
new file mode 100644
index 000000000000..846b53806406
--- /dev/null
+++ b/net-libs/pjproject/pjproject-2.12.1-r2.ebuild
@@ -0,0 +1,144 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+# TODO: Figure out a way to disable SRTP from pjproject entirely.
+EAPI=8
+
+inherit autotools flag-o-matic toolchain-funcs
+
+DESCRIPTION="Open source SIP, Media, and NAT Traversal Library"
+HOMEPAGE="https://www.pjsip.org/"
+SRC_URI="https://github.com/pjsip/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+
+LICENSE="GPL-2"
+SLOT="0/${PV}"
+
+# g729 not included due to special bcg729 handling.
+CODEC_FLAGS="g711 g722 g7221 gsm ilbc speex l16"
+VIDEO_FLAGS="sdl ffmpeg v4l2 openh264 libyuv vpx"
+SOUND_FLAGS="alsa portaudio"
+IUSE="amr debug epoll examples opus resample silk ssl static-libs webrtc
+ ${CODEC_FLAGS} g729
+ ${VIDEO_FLAGS}
+ ${SOUND_FLAGS}"
+
+RDEPEND=">=net-libs/libsrtp-2.3.0:=
+ alsa? ( media-libs/alsa-lib )
+ amr? ( media-libs/opencore-amr )
+ ffmpeg? ( media-video/ffmpeg:= )
+ g729? ( media-libs/bcg729 )
+ gsm? ( media-sound/gsm )
+ ilbc? ( media-libs/libilbc )
+ openh264? ( media-libs/openh264 )
+ opus? ( media-libs/opus )
+ portaudio? ( media-libs/portaudio )
+ resample? ( media-libs/libsamplerate )
+ sdl? ( media-libs/libsdl )
+ speex? (
+ media-libs/speex
+ media-libs/speexdsp
+ )
+ ssl? (
+ dev-libs/openssl:0=
+ )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}/pjproject-2.12.1-CVE-2022-31031.patch"
+ "${FILESDIR}/pjproject-2.12.1-r2-CVE-2022-39244.patch" # 875863
+ "${FILESDIR}/pjproject-2.12.1-r2-CVE-2022-39269.patch" # 875863
+ "${FILESDIR}/pjproject-2.12.1-r2-bashism.patch" # 865719
+ "${FILESDIR}/pjproject-2.12.1-r2-musl.patch" # 867343
+)
+
+src_prepare() {
+ default
+ rm configure || die "Unable to remove unwanted wrapper"
+ mv aconfigure.ac configure.ac || die "Unable to rename configure script source"
+ eautoreconf
+
+ cp "${FILESDIR}/pjproject-2.12.1-config_site.h" "${S}/pjlib/include/pj/config_site.h" || die "Unable to create config_site.h"
+}
+
+_pj_enable() {
+ usex "$1" '' "--disable-${2:-$1}"
+}
+
+_pj_get_define() {
+ local r="$(sed -nre "s/^#define[[:space:]]+$1[[:space:]]+//p" "${S}/pjlib/include/pj/config_site.h")"
+ [[ -z "${r}" ]] && die "Unable to fine #define $1 in config_site.h"
+ echo "$r"
+}
+
+_pj_set_define() {
+ local c=$(_pj_get_define "$1")
+ [[ "$c" = "$2" ]] && return 0
+ sed -re "s/^#define[[:space:]]+$1[[:space:]].*/#define $1 $2/" -i "${S}/pjlib/include/pj/config_site.h" || die "sed failed updating $1 to $2."
+ [[ "$(_pj_get_define "$1")" != "$2" ]] && die "sed failed to perform update for $1 to $2."
+}
+
+_pj_use_set_define() {
+ _pj_set_define "$2" $(usex "$1" 1 0)
+}
+
+src_configure() {
+ local myconf=()
+ local videnable="--disable-video"
+ local t
+
+ use debug || append-cflags -DNDEBUG=1
+
+ for t in ${CODEC_FLAGS}; do
+ myconf+=( $(_pj_enable ${t} ${t}-codec) )
+ done
+ myconf+=( $(_pj_enable g729 bcg729) )
+
+ for t in ${VIDEO_FLAGS}; do
+ myconf+=( $(_pj_enable ${t}) )
+ use "${t}" && videnable="--enable-video"
+ done
+
+ [ "${videnable}" = "--enable-video" ] && _pj_set_define PJMEDIA_HAS_VIDEO 1 || _pj_set_define PJMEDIA_HAS_VIDEO 0
+
+ LD="$(tc-getCC)" econf \
+ --enable-shared \
+ --with-external-srtp \
+ ${videnable} \
+ $(_pj_enable alsa sound) \
+ $(_pj_enable amr opencore-amr) \
+ $(_pj_enable epoll) \
+ $(_pj_enable opus) \
+ $(_pj_enable portaudio ext-sound) \
+ $(_pj_enable resample libsamplerate) \
+ $(_pj_enable resample resample-dll) \
+ $(_pj_enable resample) \
+ $(_pj_enable silk) \
+ $(_pj_enable speex speex-aec) \
+ $(_pj_enable ssl) \
+ $(_pj_enable webrtc libwebrtc) \
+ $(use_with gsm external-gsm) \
+ $(use_with portaudio external-pa) \
+ $(use_with speex external-speex) \
+ "${myconf[@]}"
+}
+
+src_compile() {
+ emake dep LD="$(tc-getCC)"
+ emake LD="$(tc-getCC)"
+}
+
+src_install() {
+ default
+
+ newbin pjsip-apps/bin/pjsua-${CHOST} pjsua
+ newbin pjsip-apps/bin/pjsystest-${CHOST} pjsystest
+
+ if use examples; then
+ insinto "/usr/share/doc/${PF}/examples"
+ doins -r pjsip-apps/src/samples
+ fi
+
+ use static-libs || rm "${ED}/usr/$(get_libdir)"/*.a || die "Error removing static archives"
+}