Files
ffmpeg-rockchip/libavformat
Martin Storsjö e65923eff0 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>
(cherry picked from commit 8f4819ce01)
2025-02-11 10:30:40 +02:00
..
2023-01-27 19:45:36 +01:00
2022-12-01 11:21:15 +01:00
2024-03-26 06:36:43 +01:00
2024-05-22 22:04:36 +02:00
2024-07-25 20:33:57 +02:00
2024-03-11 16:52:42 +01:00
2023-06-27 12:52:38 -03:00
2022-03-16 14:05:26 +02:00
2024-03-26 06:36:43 +01:00
2024-07-25 20:36:13 +02:00
2024-03-26 00:08:25 +01:00
2023-05-31 09:03:58 -07:00
2024-05-22 22:04:32 +02:00
2024-07-25 20:36:13 +02:00
2024-03-22 23:57:19 +01:00
2024-07-25 20:36:15 +02:00
2023-09-28 19:37:58 +02:00
2022-03-15 09:42:35 -03:00
2024-07-25 20:34:21 +02:00
2023-11-08 17:37:58 +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-07-25 20:34:07 +02:00
2024-07-25 20:36:16 +02:00
2024-07-25 20:36:16 +02:00
2024-07-25 20:34:28 +02:00
2024-03-27 01:04:53 +01:00
2024-05-22 17:52:30 -03:00
2024-03-26 06:36:43 +01:00
2024-03-26 06:36:43 +01:00
2024-07-25 20:36:17 +02:00