diff --git a/src/Extension/AAC.cpp b/src/Extension/AAC.cpp index f880c71f..bfe4c9db 100644 --- a/src/Extension/AAC.cpp +++ b/src/Extension/AAC.cpp @@ -279,6 +279,11 @@ bool AACTrack::inputFrame(const Frame::Ptr &frame) { } auto sub_frame = std::make_shared >(frame, (char *) ptr, frame_len, ADTS_HEADER_LEN); ptr += frame_len; + if (ptr > end) { + WarnL << "invalid aac length in adts header: " << frame_len + << ", remain data size: " << end - (ptr - frame_len); + break; + } sub_frame->setCodecId(CodecAAC); if (inputFrame_l(sub_frame)) { ret = true;