Check empty slice in H.265 bitstream parser.

This is cherry-picked from WebKit's PR by youenn@apple.com. The original
PR: https://github.com/WebKit/WebKit/pull/31525

Bug: chromium:41480904
Change-Id: I69c7c8d5842a576fa18432fb9f85c6890b47f3ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358200
Commit-Queue: Jianlin Qiu <jianlin.qiu@intel.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42708}
This commit is contained in:
Qiu Jianlin 2024-07-31 21:32:41 +08:00 committed by WebRTC LUCI CQ
parent c7eacf81f2
commit fd98638726

View File

@ -419,6 +419,10 @@ const H265SpsParser::SpsState* H265BitstreamParser::GetSPS(uint32_t id) const {
}
void H265BitstreamParser::ParseSlice(rtc::ArrayView<const uint8_t> slice) {
if (slice.empty()) {
RTC_LOG(LS_WARNING) << "Empty slice in H265 bitstream.";
return;
}
H265::NaluType nalu_type = H265::ParseNaluType(slice[0]);
switch (nalu_type) {
case H265::NaluType::kVps: {