From dc84508ce5307bfc840728b3dcb7c89ac1b433fc Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 20 Sep 2026 23:43:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(rtmp):=20=E4=BF=AE=E5=A4=8DRTMP=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E6=B6=88=E6=81=AF=E8=A7=A3=E6=9E=90=E8=AF=BB=E8=B6=8A?= =?UTF-8?q?=E7=95=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtmp/RtmpProtocol.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Rtmp/RtmpProtocol.cpp b/src/Rtmp/RtmpProtocol.cpp index 672f506f..6974fdc2 100644 --- a/src/Rtmp/RtmpProtocol.cpp +++ b/src/Rtmp/RtmpProtocol.cpp @@ -878,6 +878,9 @@ void RtmpProtocol::handle_chunk(RtmpPacket::Ptr packet) { } case MSG_WIN_SIZE: { + if (chunk_data.buffer.size() < 4) { + throw std::runtime_error("MSG_WIN_SIZE: Not enough data"); + } // 如果窗口太小,会导致发送sendAcknowledgement时无限递归:https://github.com/ZLMediaKit/ZLMediaKit/issues/1839 [AUTO-TRANSLATED:05267962] // If the window is too small, it will cause infinite recursion when sending sendAcknowledgement: https://github.com/ZLMediaKit/ZLMediaKit/issues/1839 // 窗口太大,也可能导致fms服务器认为播放器心跳超时 [AUTO-TRANSLATED:30147e88] @@ -888,6 +891,9 @@ void RtmpProtocol::handle_chunk(RtmpPacket::Ptr packet) { } case MSG_SET_PEER_BW: { + if (chunk_data.buffer.size() < 5) { + throw std::runtime_error("MSG_SET_PEER_BW: Not enough data"); + } _bandwidth = load_be32(&chunk_data.buffer[0]); _band_limit_type = chunk_data.buffer[4]; TraceL << "MSG_SET_PEER_BW:" << _bandwidth << " " << (int)_band_limit_type;