History

Merge "Avoid overflow in calc_iframe_target_size" into main

Yaowu Xu committed 5 years ago

Commit 826d7ca2 parents 002f140 5f345a91 file · +6 −2Browse files

Unified · Split

vp8/encoder/ratectrl.c+6−2
@@ -349,8 +349,12 @@ static void calc_iframe_target_size(VP8_COMP *cpi) { · 348 unmodified lines
349 }349 }
350 350
351 if (cpi->oxcf.rc_max_intra_bitrate_pct) {351 if (cpi->oxcf.rc_max_intra_bitrate_pct) {
352 unsigned int max_rate =352 unsigned int max_rate;
353 cpi->per_frame_bandwidth * cpi->oxcf.rc_max_intra_bitrate_pct / 100;353 // This product may overflow unsigned int
354 uint64_t product = cpi->per_frame_bandwidth;
355 product *= cpi->oxcf.rc_max_intra_bitrate_pct;
356 product /= 100;
357 max_rate = (unsigned int)VPXMIN(INT_MAX, product);
354 358
355 if (target > max_rate) target = max_rate;359 if (target > max_rate) target = max_rate;
356 }360 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t