Files
FFmpeg/libavformat
Martin Storsjö 8f4819ce01 rtmpproto: Avoid rare crashes in the fail: codepath in rtmp_open
When running the cleanup in rtmp_close on failures in rtmp_open,
we can in rare cases end up using rt->playpath, assuming that it
is still set.

The crash could happen if we hit the fail codepath in rtmp_open
while publishing (rt->is_input == 0) with rt->state set to
a value > STATE_FCPUBLISH.

This would normally not happen while publishing; either we have
an error (and rt->state <= STATE_FCPUBLISH) or we reach
rt->state = STATE_PUBLISHING, and then we also return successfully
from rtmp_open.

The unexpected combination of states could happen if the server
responds with e.g. "NetStream.Play.Stop" while expecting
"NetStream.Publish.Start"; this sets rt->state to STATE_STOPPED,
which also fulfills the condition "> STATE_FCPUBLISH".

We don't need to free the rt->playpath/tcurl/flashver strings here;
they're handled via AVOption, and thus are freed automatically when
the protocol instance is freed (that's why they aren't freed
manually within the rtmp_close function either).

We also don't need to free the AVDictionary with options; it's
owned by the caller.

A smaller fix would be to just call rtmp_close before freeing
the strings and dictionary, but as we don't need to free them
at all, let's remove that redundant code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-01-28 19:56:39 +02:00
..
2024-03-31 00:08:43 +01:00
2023-01-27 19:45:36 +01:00
2024-08-28 16:27:54 +02:00
2024-09-24 15:37:15 +02:00
2021-03-31 22:01:36 +02:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-26 06:36:43 +01:00
2024-03-31 00:08:43 +01:00
2024-05-09 16:17:39 +02:00
2025-01-17 23:33:27 +01:00
2025-01-01 21:33:46 +01:00
2024-05-25 13:51:27 +02:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-11 16:52:42 +01:00
2024-12-02 03:14:47 +01:00
2024-06-19 10:12:50 -03:00
2022-03-16 14:05:26 +02:00
2024-03-31 00:08:43 +01:00
2024-03-26 06:36:43 +01:00
2024-06-04 11:46:27 +02:00
2024-07-21 16:41:23 +02:00
2023-05-31 09:03:58 -07:00
2022-02-24 12:56:49 +01:00
2024-10-12 11:21:14 -03:00
2024-04-17 18:31:06 +05:30
2024-05-01 02:57:12 +02:00
2024-04-06 12:59:56 +02:00
2024-04-06 12:59:56 +02:00
2024-04-06 12:59:56 +02:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-07-21 16:41:43 +02:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-07-02 21:57:24 +02:00
2024-03-31 00:08:43 +01:00
2024-11-03 10:53:15 +11:00
2022-03-15 09:42:36 -03:00
2024-03-15 12:51:15 +01:00
2024-03-15 12:51:15 +01:00
2022-03-26 00:42:00 +02:00
2024-03-15 12:51:15 +01:00
2024-03-31 00:08:43 +01:00
2024-08-14 18:20:58 +02:00
2024-07-21 17:02:11 +02:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-03-31 00:08:43 +01:00
2024-07-21 17:02:11 +02:00
2024-07-07 23:36:33 +02:00
2024-03-26 06:36:43 +01:00
2025-01-21 22:55:09 +01:00
2024-03-26 06:36:43 +01:00
2024-07-21 17:02:12 +02:00
2024-03-31 00:08:43 +01:00