History

avcodec/utils: Fix signed integer overflow in rc_initial_buffer_occupancy initialization

Signed integer overflow is undefined behavior. Detected with clang and -fsanitize=signed-integer-overflow

Vitaly Buka committed 9 years ago

Commit 8c2bb101 parent f3913dc1 file · +1 −1Browse files

Unified · Split

libavcodec/utils.c+1−1
@@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 970 unmodified lines
971 }971 }
972 972
973 if (!avctx->rc_initial_buffer_occupancy)973 if (!avctx->rc_initial_buffer_occupancy)
974 avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;974 avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
975 975
976 if (avctx->ticks_per_frame && avctx->time_base.num &&976 if (avctx->ticks_per_frame && avctx->time_base.num &&
977 avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {977 avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {

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