* rocDecode/HEVC: Fixed the segmentation fault at the end of decode session on stream chimei_demo_1080p_h265_60fps.mp4 or similar streams. (#72)
Root cause: num_entry_point_offsets in the slice header of frame #2164 is 674, exceeding the entry_point_offset_minus1[440] array size. Parser writes beyond the array boundary, corrupting memory. Frame #2164 is not in conformance of the HEVC spec. We need to put the constraint from the spec on the num_entry_point_offsets parsed from the stream. Also need to change the array size to the max possible for 8K.
Esse commit está contido em:
@@ -1796,7 +1796,21 @@ bool HEVCVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size) {
|
||||
}
|
||||
|
||||
if (pps_ptr->tiles_enabled_flag || pps_ptr->entropy_coding_sync_enabled_flag) {
|
||||
int max_num_entry_point_offsets; // 7.4.7.1
|
||||
if (!pps_ptr->tiles_enabled_flag && pps_ptr->entropy_coding_sync_enabled_flag) {
|
||||
max_num_entry_point_offsets = pic_height_in_ctbs_y_ - 1;
|
||||
}
|
||||
else if (pps_ptr->tiles_enabled_flag && !pps_ptr->entropy_coding_sync_enabled_flag) {
|
||||
max_num_entry_point_offsets = (pps_ptr->num_tile_columns_minus1 + 1) * (pps_ptr->num_tile_rows_minus1 + 1) - 1;
|
||||
}
|
||||
else {
|
||||
max_num_entry_point_offsets = (pps_ptr->num_tile_columns_minus1 + 1) * pic_height_in_ctbs_y_ - 1;
|
||||
}
|
||||
m_sh_->num_entry_point_offsets = Parser::ExpGolomb::ReadUe(nalu, offset);
|
||||
if (m_sh_->num_entry_point_offsets > max_num_entry_point_offsets) {
|
||||
m_sh_->num_entry_point_offsets = max_num_entry_point_offsets;
|
||||
}
|
||||
|
||||
if (m_sh_->num_entry_point_offsets) {
|
||||
m_sh_->offset_len_minus1 = Parser::ExpGolomb::ReadUe(nalu, offset);
|
||||
for (int i = 0; i < m_sh_->num_entry_point_offsets; i++) {
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário