Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 888879 - net-misc/asterisk / net-libs/pjproject interaction bug
Summary: net-misc/asterisk / net-libs/pjproject interaction bug
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jaco Kroon
Keywords: PullRequest
Depends on:
Reported: 2022-12-29 16:02 UTC by Jaco Kroon
Modified: 2023-04-05 12:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Jaco Kroon 2022-12-29 16:02:46 UTC
asterisk crashes inside pjsip library.  Referenced URL.

Reproducible: Always
Comment 1 Jaco Kroon 2023-02-24 09:15:26 UTC
Hi Reuben,

I'm finally catching up on all my TODO's.

Can you possibly confirm you can reproduce this with pjproject compiled with USE=-debug?

I already have this in the ebuild:

use debug || append-cflags -DNDEBUG=1

Which *should* sort this out?

And the reason for that is because NDEBUG actually affects glibc include headers too (like assert goes to a no-op), and even a #define NDEBUG 0 won't fix the issue, it needs to be undefined.

Just a coupld of samples from the compile output with USE=-debug:

[ebuild     U  ] net-libs/pjproject-2.13:0/2.13::gentoo [2.12.1-r2:0/2.12.1::gentoo] USE="alsa g729 gsm ssl -amr -debug -epoll -examples -ffmpeg -g711 -g722 -g7221 -ilbc -l16 -libyuv -openh264 -opus -portaudio -resample -sdl -silk -speex -static-libs -v4l2 -vpx -webrtc" 0 KiB
x86_64-pc-linux-gnu-gcc -c -Wall -DPJ_AUTOCONF=1  -O2 -march=native -pipe -frecord-gcc-switches -fno-common -DNDEBUG=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC   -O2 -march=native -pipe -frecord-gcc-switches -fno-common -DNDEBUG=1 -I../include \
	-o output/pjlib-test-x86_64-pc-linux-gnu/rand.o \
x86_64-pc-linux-gnu-gcc -c -Wall -DPJ_AUTOCONF=1  -O2 -march=native -pipe -frecord-gcc-switches -fno-common -DNDEBUG=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC   -O2 -march=native -pipe -frecord-gcc-switches -fno-common -DNDEBUG=1 -I../include \
	-o output/pjlib-test-x86_64-pc-linux-gnu/rbtree.o \
x86_64-pc-linux-gnu-gcc -c -Wall -DPJ_AUTOCONF=1  -O2 -march=native -pipe -frecord-gcc-switches -fno-common -DNDEBUG=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC   -O2 -march=native -pipe -frecord-gcc-switches -fno-common -DNDEBUG=1 -I../include \
	-o output/pjlib-test-x86_64-pc-linux-gnu/select.o \

So I believe this should sort out your issues?

I'm closing as resolved invalid since I *believe* this is caused by you setting USE=debug for pjproject ... and this is causing the problem.  This really should be a bug upstream at pjproject (not asterisk) because quite frankly, an assert should be for something that should never ever happen, everything else should have required checks.  The PJ_ASSERT_RETURN does have a return on production - but this precludes testing of failure-paths in calling code in debug mode ... which makes absolutely no sense to me.
Comment 2 Jaco Kroon 2023-03-13 06:44:39 UTC
Reuben has dug a bit more and found a relevant patch.  Will include in 2.13-r1.
Comment 3 Jaco Kroon 2023-03-13 08:22:47 UTC
Reuben, do you mind testing the PR at please?
Comment 4 Reuben Farrelly 2023-03-13 11:48:06 UTC
Built successfully, running and testing now.  Let's leave it 24+ hours to confirm no crashes.
Comment 5 Reuben Farrelly 2023-03-14 12:09:44 UTC
Confirming I have had no crashes and no instability with the 2.13-r1 pull for the past 24 hours, so I would support this now going live into portage.

Thanks Jaco!
Comment 6 Larry the Git Cow gentoo-dev 2023-04-05 12:00:58 UTC
The bug has been closed via the following commit(s):

commit 0697e55a6fa27051a99aa59fde8b5716c022696e
Author:     Jaco Kroon <>
AuthorDate: 2023-03-13 06:54:28 +0000
Commit:     Joonas Niilola <>
CommitDate: 2023-04-05 11:56:14 +0000

    net-libs/pjproject: Add 2.13-r1
    Signed-off-by: Jaco Kroon <>
    Signed-off-by: Joonas Niilola <>

 ...3537-buffer-overread-on-STUN-error-decode.patch |  95 ++++++++++++++
 ...2022-23547-buffer-overread-on-STUN-decode.patch |  50 ++++++++
 ...NOTIFY-tdata-is-set-before-sending-it_new.patch |  46 +++++++
 net-libs/pjproject/pjproject-2.13-r1.ebuild        | 142 +++++++++++++++++++++
 4 files changed, 333 insertions(+)