Skip to content

SRS crash when we publish invalid streaming with dash stream setting #3770

@5centscdn

Description

@5centscdn

Note: Please read FAQ before file an issue, see #2716

Description

Please description your issue here

  1. SRS Version: 6.0.65

  2. SRS Log:

[2023-08-16 20:59:07.220][INFO][2567][8h833a55] connected stream, tcUrl=rtmp://207.188.7.80:1935/arena1, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=arena1, stream=main, param=, args=null
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] new live source, stream_url=/arena1/main
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] source url=/arena1/main, ip=207.188.7.80, cache=1/2500, is_edge=0, source_id=/
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] DASH: Config fragment=10000ms, period=10000ms, window=3, timeshit=300000ms, home=./objs/nginx/html, mpd=[app]/[stream].mpd
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] ignore disabled exec for vhost=__defaultVhost__
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
ASAN:DEADLYSIGNAL
=================================================================
==2567==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x559b81754d17 bp 0x7fba38d4b0d0 sp 0x7fba38d4b0b0 T1)
==2567==The signal is caused by a READ memory access.
==2567==Hint: address points to the zero page.
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.

  1. SRS Config:
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
vhost __defaultVhost__ {
    dash {
        enabled         on;
        dash_fragment       10;
        dash_update_period  10;
        dash_window_size    3;
        dash_path           ./objs/nginx/html;
        dash_mpd_file       [app]/[stream].mpd;
    }
}

Replay

Please describe how to replay the bug?

Step 1: Below is ffprobe out for my source stream codec and information.

Input #0, flv, from 'rtmp://51.210.214.151/arena1/main':
  Duration: N/A, start: 3406.980000, bitrate: 384 kb/s
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s

there is no video only audio stream is there

Step 2: when we publish this stream with ffmpeg to srs, then srs will crash

FFMPEG:
Input #0, flv, from 'rtmp://51.210.214.151/arena1/main':
  Duration: N/A, start: 3325.524000, bitrate: 384 kb/s
    Stream #0:0: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
[tcp @ 0x56402facd3e0] Connection to tcp://207.188.7.80:1935 failed: Connection refused
[rtmp @ 0x56402faccd80] Cannot open connection tcp://207.188.7.80:1935
rtmp://207.188.7.80/arena1/main: Connection refused

SRS:
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] new live source, stream_url=/arena1/main
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] source url=/arena1/main, ip=207.188.7.80, cache=1/2500, is_edge=0, source_id=/
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] DASH: Config fragment=10000ms, period=10000ms, window=3, timeshit=300000ms, home=./objs/nginx/html, mpd=[app]/[stream].mpd
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] ignore disabled exec for vhost=__defaultVhost__
[2023-08-16 20:59:07.220][INFO][2567][8h833a55] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
ASAN:DEADLYSIGNAL
=================================================================
==2567==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x559b81754d17 bp 0x7fba38d4b0d0 sp 0x7fba38d4b0b0 T1)
==2567==The signal is caused by a READ memory access.
==2567==Hint: address points to the zero page.
ASAN:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.

Expect

How can we prevent SRS from crashing? Is there a way to validate the source codec of a stream and disable stream publishing? We are currently publishing multiple streams and lack information about the source stream codec, which is causing crashes in SRS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnglishNativeThis issue is conveyed exclusively in English.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions