!260 There is a risk of out-of-bounds access to arrays.

Merge pull request !260 from zhenghongda/cherry-pick-1724642162
This commit is contained in:
openharmony_ci 2024-08-26 08:23:56 +00:00 committed by Gitee
commit 74488ac962
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -506,7 +506,7 @@ static int mpegts_drm_find_hevc_cei_nal_unit(uint8_t *data, uint32_t data_size,
/* sei is not after frame data. */
av_log(NULL, AV_LOG_DEBUG, "h265 frame found\n");
return 0;
} else if (nal_type == 39) { // 39: SEI nal unit
} else if ((nal_type == 39) && (i + DRM_H265_PAYLOAD_TYPE_OFFSET < data_size)) { // 39: SEI nal unit
if (data[i + DRM_H265_PAYLOAD_TYPE_OFFSET] == DRM_USER_DATA_UNREGISTERED_TAG) {
*cei_start_pos = i;
}
@ -600,7 +600,8 @@ static int mpegts_drm_find_cei_pos(enum AVCodecID codec_id, uint8_t *data, uint3
i += (uint32_t)DRM_LEGACY_LEN;
}
}
if ((*cei_start_pos != (uint32_t)DRM_INVALID_START_POS) && (*cei_end_pos != (uint32_t)DRM_INVALID_START_POS)) {
if ((*cei_start_pos != (uint32_t)DRM_INVALID_START_POS) && (*cei_end_pos != (uint32_t)DRM_INVALID_START_POS) &&
(*cei_start_pos < *cei_end_pos) && (*cei_end_pos <= data_size)) {
return 1; // 1 true
}
return 0;