Check arrayview is not empty before accessing it
Bug: webrtc:353764813 No-Try: True Change-Id: I873f115c13e23d827f3967bc505da4b9d1a70753 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/357580 Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42657}
This commit is contained in:
parent
4bded9601b
commit
02f375da42
@ -307,6 +307,9 @@ H264BitstreamParser::Result H264BitstreamParser::ParseNonParameterSetNalu(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void H264BitstreamParser::ParseSlice(rtc::ArrayView<const uint8_t> slice) {
|
void H264BitstreamParser::ParseSlice(rtc::ArrayView<const uint8_t> slice) {
|
||||||
|
if (slice.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
H264::NaluType nalu_type = H264::ParseNaluType(slice[0]);
|
H264::NaluType nalu_type = H264::ParseNaluType(slice[0]);
|
||||||
switch (nalu_type) {
|
switch (nalu_type) {
|
||||||
case H264::NaluType::kSps: {
|
case H264::NaluType::kSps: {
|
||||||
|
|||||||
@ -238,7 +238,9 @@ rtc::Buffer SpsVuiRewriter::ParseOutgoingBitstreamAndRewrite(
|
|||||||
nalu_index.payload_start_offset - nalu_index.start_offset);
|
nalu_index.payload_start_offset - nalu_index.start_offset);
|
||||||
rtc::ArrayView<const uint8_t> nalu = buffer.subview(
|
rtc::ArrayView<const uint8_t> nalu = buffer.subview(
|
||||||
nalu_index.payload_start_offset, nalu_index.payload_size);
|
nalu_index.payload_start_offset, nalu_index.payload_size);
|
||||||
|
if (nalu.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (H264::ParseNaluType(nalu[0]) == H264::NaluType::kSps) {
|
if (H264::ParseNaluType(nalu[0]) == H264::NaluType::kSps) {
|
||||||
// Check if stream uses picture order count type 0, and if so rewrite it
|
// Check if stream uses picture order count type 0, and if so rewrite it
|
||||||
// to enable faster decoding. Streams in that format incur additional
|
// to enable faster decoding. Streams in that format incur additional
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user