修复非法aac rtp包导致的除0崩溃问题: #1869

This commit is contained in:
ziyue 2022-08-10 10:44:34 +08:00
parent 795b4dbbd3
commit b34db64961

View File

@ -93,6 +93,11 @@ bool AACRtpDecoder::inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) {
auto end = ptr + payload_size; auto end = ptr + payload_size;
//首2字节表示Au-Header的个数单位bit所以除以16得到Au-Header个数 //首2字节表示Au-Header的个数单位bit所以除以16得到Au-Header个数
auto au_header_count = ((ptr[0] << 8) | ptr[1]) >> 4; auto au_header_count = ((ptr[0] << 8) | ptr[1]) >> 4;
if (!au_header_count) {
//问题issue: https://github.com/ZLMediaKit/ZLMediaKit/issues/1869
WarnL << "invalid aac rtp au_header_count";
return false;
}
//记录au_header起始指针 //记录au_header起始指针
auto au_header_ptr = ptr + 2; auto au_header_ptr = ptr + 2;
ptr = au_header_ptr + au_header_count * 2; ptr = au_header_ptr + au_header_count * 2;