pjproject icon indicating copy to clipboard operation
pjproject copied to clipboard

../src/pjmedia/stream_info.c:377: pjmedia_stream_info_from_sdp: Assertion `stream_idx < local->media_count' failed. Aborted

Open fraglantia opened this issue 2 years ago • 3 comments

Describe the bug

Logs:

>>> siprtp: ../src/pjmedia/stream_info.c:377: pjmedia_stream_info_from_sdp: Assertion `stream_idx < local->media_count' failed.
Aborted

Steps to reproduce

Server side:

git clone https://github.com/pjsip/pjproject.git
cd pjproject
git checkout 2.14.1
./configure
make dep && make

./pjsip-apps/bin/samples/x86_64-unknown-linux-gnu/siprtp -p 5080

Client side:

cat replay.hex | xxd -r -p | nc -u 127.0.1.1 5080
  • replay.hex:
494E56495445207369703A3132372E302E302E313A35303830205349502F322E300D0A5669613A205349502F322E302F554450203132372E302E303B313A353038313B72706F72743B6272616E63683D7A39684734624B506A367177746544414845704D624E334862636545666F324E6E595A6374536457530D0A4D61782D466F7277617264733A2037300D0A46726F6D3A207369703A3132372E302E302E313B7461673D6D6E683641464F596F77374E474B727A7162344D6E51555054353064395766530D0A546F3A207369703A3132372E302E302E310D0A436F6E746163743A203C7369703A3132372E302E302E313A353038313E0D0A43616C6C2D49443A2030744549654875336F5A764A7856566851417A7046584145555A2D56656257550D0A435365713A203931303520494E564954450D0A416C6C6F773A20494E564954452C2041434B2C204259452C2043414E43454C2C205550444154450D0A537570706F727465643A200D0A436F6E74656E742D547970653A206170706C69636174696F6E2F7364700D0A436F6E74656E742D4C656E6774683A2020203231330D0A0D0A763D300D0A6F3D706A7369702D7369707274702033393336323235383535203339333632323538353520494E20495034203165633665393832346561640D0A733D706A7369700D0A633D494E20495034203132372E302E302E310D0A743D30203000406D3D617564696F2034303130205254502F4156502030203132310D0A613D7274706D61703A302050434D552F383030300D2A613D73656E64726563760D0A613D7274706D61703A313231203D706A7369700D0A633D494E20495034203132372E302E302E310D0A743D3020300D0A

PJSIP version

2.14.1

Context

Tested on Ubuntu 20.04 using the default configurations of PJSIP.

Log, call stack, etc

./pjsip-apps/bin/samples/x86_64-unknown-linux-gnu/siprtp -p 5080 --app-log-level=5
12:49:52.364         os_core_unix.c !pjlib 2.14.1 for POSIX initialized
12:49:52.364         sip_endpoint.c  Creating endpoint instance...
12:49:52.364                  pjlib  select() I/O Queue created (0x555555917f98)
12:49:52.364         sip_endpoint.c  Module "mod-msg-print" registered
12:49:52.364        sip_transport.c  Transport manager created.
12:49:52.364      udp0x55555590d310  SIP UDP transport started, published address is 127.0.1.1:5080
12:49:52.364               siprtp.c  SIP UDP listening on 127.0.1.1:5080
12:49:52.364         sip_endpoint.c  Module "mod-tsx-layer" registered
12:49:52.364         sip_endpoint.c  Module "mod-stateful-util" registered
12:49:52.364         sip_endpoint.c  Module "mod-ua" registered
12:49:52.364         sip_endpoint.c  Module "mod-100rel" registered
12:49:52.364         sip_endpoint.c  Module "mod-invite" registered
12:49:52.364         sip_endpoint.c  Module "mod-siprtpapp" registered
12:49:52.364         sip_endpoint.c  Module "mod-siprtp-log" registered
12:49:52.365             alsa_dev.c  ALSA driver found 0 devices
12:49:52.365             alsa_dev.c  ALSA initialized
12:49:52.365                  pjlib  select() I/O Queue created (0x555555931fd8)
12:49:52.366               siprtp.c  Ready for incoming calls (max=1)

Enter menu character:
  s    Summary
  l    List all calls
  h    Hangup a call
  H    Hangup all calls
  q    Quit

>>> 12:49:57.303         sip_endpoint.c !Processing incoming message: Request msg INVITE/cseq=9105 (rdata0x555555921b18)
12:49:57.303               siprtp.c  .RX 630 bytes Request msg INVITE/cseq=9105 (rdata0x555555921b18) from 127.0.0.1:41928:
INVITE sip:127.0.0.1:5080 SIP/2.0
Via: SIP/2.0/UDP 127.0.0;1:5081;rport;branch=z9hG4bKPj6qwteDAHEpMbN3HbceEfo2NnYZctSdWS
Max-Forwards: 70
From: sip:127.0.0.1;tag=mnh6AFOYow7NGKrzqb4MnQUPT50d9WfS
To: sip:127.0.0.1
Contact: <sip:127.0.0.1:5081>
Call-ID: 0tEIeHu3oZvJxVVhQAzpFXAEUZ-VebWU
CSeq: 9105 INVITE
Allow: INVITE, ACK, BYE, CANCEL, UPDATE
Supported:
Content-Type: application/sdp
Content-Length:   213

v=0
o=pjsip-siprtp 3936225855 3936225855 IN IP4 1ec6e9824ead
s=pjsip
c=IN IP4 127.0.0.1
t=0 0
--end msg--
12:49:57.303      tsx0x7ffff0002468  ..Transaction created for Request msg INVITE/cseq=9105 (rdata0x555555921b18)
12:49:57.303      tsx0x7ffff0002468  .Incoming Request msg INVITE/cseq=9105 (rdata0x555555921b18) in state Null
12:49:57.303      tsx0x7ffff0002468  ..State changed from Null to Trying, event=RX_MSG
12:49:57.303      dlg0x7ffff0000c18  ...Transaction tsx0x7ffff0002468 state changed to Trying
12:49:57.303      dlg0x7ffff0000c18  .UAS dialog created
12:49:57.303      dlg0x7ffff0000c18  .Module mod-invite added as dialog usage, data=0x7ffff00036f8
12:49:57.303      dlg0x7ffff0000c18  ..Session count inc to 3 by mod-invite
12:49:57.303      inv0x7ffff0000c18  .UAS invite session created for dialog dlg0x7ffff0000c18
12:49:57.304             sip_util.c  ..Response msg 200/INVITE/cseq=9105 (tdta0x7ffff00063a8) created
12:49:57.304      inv0x7ffff0000c18  ..SDP negotiation done: Success
siprtp: ../src/pjmedia/stream_info.c:377: pjmedia_stream_info_from_sdp: Assertion `stream_idx < local->media_count' failed.
Aborted

fraglantia avatar Nov 01 '24 03:11 fraglantia

There's no media in the SDP.

sauwming avatar Nov 11 '24 01:11 sauwming

There's no media in the SDP.

@sauwming, should missing media field m= in SDP not result in assertion error? IMO doing so is not graceful handling. Would it be better handled with app_perror or such in the higher level?

fraglantia avatar Nov 11 '24 04:11 fraglantia

The sample apps located in pjsip-apps/src/samples are for proof of concept, hence they don't have the most comprehensive error checking.

sauwming avatar Nov 11 '24 04:11 sauwming