1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Fix crash related to unconfigured intakes

This commit is contained in:
Moritz Grimm 2021-01-07 04:19:06 +01:00
parent 656fff81e8
commit 80afe5baf7
3 changed files with 18 additions and 1 deletions

2
NEWS
View File

@ -4,6 +4,8 @@ Changes in 1.0.2, released on XXXX-XX-XX:
that do not contain the respective values. From gui-lux on Github (#16).
* Fix a crash in one instance of querying the metadata program. From taku0220
on Github (#23).
* Fix a crash when referencing an unconfigured intake in a stream. From
Optiqus on Github (#28).
* Minor documentation tweak

View File

@ -383,6 +383,7 @@ stream_configure(struct stream *s)
cfg_server_list_t servers;
cfg_stream_t cfg_stream;
cfg_server_t cfg_server;
cfg_intake_t cfg_intake;
const char *server;
streams = cfg_get_streams();
@ -409,6 +410,14 @@ stream_configure(struct stream *s)
return (-1);
}
cfg_intake = stream_get_cfg_intake(s);
if (0 > cfg_intake_validate(cfg_intake, NULL)) {
log_error("stream: %s: referencing unconfigured intake (%s)",
s->name, cfg_intake_get_name(cfg_intake));
_stream_reset(s);
return (-1);
}
return (0);
}

View File

@ -10,6 +10,8 @@ Suite * stream_suite(void);
void setup_checked(void);
void teardown_checked(void);
cfg_intake_list_t intakes;
START_TEST(test_stream)
{
stream_t s;
@ -17,6 +19,7 @@ START_TEST(test_stream)
char *m_str;
cfg_server_t srv_cfg;
cfg_stream_t str_cfg;
cfg_intake_t int_cfg;
cfg_server_list_t servers = cfg_get_servers();
cfg_stream_list_t streams = cfg_get_streams();
@ -32,7 +35,8 @@ START_TEST(test_stream)
ck_assert_ptr_ne(srv_cfg, NULL);
str_cfg = stream_get_cfg_stream(s);
ck_assert_ptr_ne(str_cfg, NULL);
ck_assert_ptr_ne(stream_get_cfg_intake(s), NULL);
int_cfg = stream_get_cfg_intake(s);
ck_assert_ptr_ne(int_cfg, NULL);
ck_assert_int_ne(stream_configure(s), 0);
ck_assert_int_eq(cfg_server_set_hostname(srv_cfg, servers, "localhost", NULL), 0);
@ -48,6 +52,8 @@ START_TEST(test_stream)
ck_assert_int_eq(cfg_stream_set_mountpoint(str_cfg, streams, "/test.ogg", NULL), 0);
ck_assert_int_ne(stream_configure(s), 0);
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "mp3", NULL), 0);
ck_assert_int_ne(stream_configure(s), 0);
cfg_intake_set_filename(int_cfg, intakes, "stream_test", NULL);
ck_assert_int_eq(stream_configure(s), 0);
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "ogg", NULL), 0);
ck_assert_int_eq(stream_configure(s), 0);