Commit 321294ad authored by Mark Thompson's avatar Mark Thompson

h264_metadata: Avoid integer overflow in bitrate

Fixes CID #1439664.
parent 581b4125
...@@ -226,10 +226,10 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, ...@@ -226,10 +226,10 @@ static int h264_metadata_update_sps(AVBSFContext *bsf,
if (sps->vui.nal_hrd_parameters_present_flag) { if (sps->vui.nal_hrd_parameters_present_flag) {
bit_rate = (sps->vui.nal_hrd_parameters.bit_rate_value_minus1[0] + 1) * bit_rate = (sps->vui.nal_hrd_parameters.bit_rate_value_minus1[0] + 1) *
(1 << (sps->vui.nal_hrd_parameters.bit_rate_scale + 6)); (INT64_C(1) << (sps->vui.nal_hrd_parameters.bit_rate_scale + 6));
} else if (sps->vui.vcl_hrd_parameters_present_flag) { } else if (sps->vui.vcl_hrd_parameters_present_flag) {
bit_rate = (sps->vui.vcl_hrd_parameters.bit_rate_value_minus1[0] + 1) * bit_rate = (sps->vui.vcl_hrd_parameters.bit_rate_value_minus1[0] + 1) *
(1 << (sps->vui.vcl_hrd_parameters.bit_rate_scale + 6)); (INT64_C(1) << (sps->vui.vcl_hrd_parameters.bit_rate_scale + 6));
// Adjust for VCL vs. NAL limits. // Adjust for VCL vs. NAL limits.
bit_rate = bit_rate * 6 / 5; bit_rate = bit_rate * 6 / 5;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment