RTP sout with file:/// SDP output segfaults
It seems that any configuration with RTP stream out and file SDP-out gives a segfault on start.
Reproduce:
./vlc -vvv input_stream --sout "#rtp{dst=127.0.0.1,sdp=file:///tmp/foo.sdp}"
Output
...
[0x8b69158] main stream output debug: stream=`rtp'
[0x8b69838] main stream out debug: looking for sout stream module: 2 candidates
[0x8b69838] main stream out debug: set config option: sout-rtp-dst to 127.0.0.1
[0x8b69838] main stream out debug: set config option: sout-rtp-sdp to file:///tmp/foo.sdp
Segmentation fault
Backtrace:
[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0xb7d02323 in strlen () from /lib/tls/i686/cmov/libc.so.6
[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0xb7ceae68 in fputs () from /lib/tls/i686/cmov/libc.so.6
[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0xb6747889 in FileSetup (p_stream=0x98c4420) at rtp.c:1408
[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0xb6748540 in SDPHandleUrl (p_stream=0x98c4420, psz_url=<value optimized out>) at rtp.c:671
[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0xb674b671 in Open (p_this=0x98c4420) at rtp.c:530
[#5](https://code.videolan.org/videolan/vlc/-/issues/5) 0xb7f35653 in __module_need (p_this=0x98c4420, psz_capability=0xb7f7d107 "sout stream", psz_name=0x9922658 "rtp", b_strict=true) at modules/modules.c:583
[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0xb7f57716 in sout_StreamNew (p_sout=0x98c3d40, psz_chain=0x99fe528 "rtp{dst=127.0.0.1,sdp=file:///tmp/foo.sdp}") at stream_output/stream_output.c:793
[#7](https://code.videolan.org/videolan/vlc/-/issues/7) 0xb7f58844 in __sout_NewInstance (p_parent=0x99fcb08, psz_dest=0x99fc9e0 "#rtp{dst=127.0.0.1,sdp=file:///tmp/foo.sdp}") at stream_output/stream_output.c:116
[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0xb7efb442 in input_resource_RequestSout (p_resource=0x99fcb38, p_sout=0x0, psz_sout=0x99fc9e0 "#rtp{dst=127.0.0.1,sdp=file:///tmp/foo.sdp}") at input/resource.c:123
[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0xb7ef8fa8 in Init (p_input=0x99fcb08) at input/input.c:878
[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0xb7efa8fb in Run (p_this=0x99fcb08) at input/input.c:540
[#11](https://code.videolan.org/videolan/vlc/-/issues/11) 0xb7f3bf68 in thread_entry (data=0x99fdab0) at misc/threads.c:58
[#12](https://code.videolan.org/videolan/vlc/-/issues/12) 0xb7e1a50f in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
[#13](https://code.videolan.org/videolan/vlc/-/issues/13) 0xb7d6ca0e in clone () from /lib/tls/i686/cmov/libc.so.6
The segfault seems to come from modules/stream_out/rtp.c FileSetup being called from Open caused further by fputs being passed p_sys->psz_sdp which is NULL.
p_sys->psz_sdp is generated only at Add which seems to be called after Open. The Add-function however generates the file also and this seems to work just by commenting out the FileSetup call in Open.
This is most likely caused by this commit: http://git.videolan.org/gitweb.cgi?p=vlc.git;a=commitdiff;h=c1c6933240eefed15674bd4e1dd50e2a37f66dee so I'm assigning to courmisch