History

avcodec/hevc_ps: Avoid signed overflow before check on QP

Fixes: signed integer overflow: -2147483648 - 5 cannot be represented in type 'int' Fixes: 58066/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5312995835379712

Michael Niedermayer committed 3 years ago

Commit bf3f91c1 parent 69eb8191 file · +3 −3Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/hevc_ps.c+3−3
@@ -1529,9 +1529,9 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, · 1528 unmodified lines
15291529 pps->pps_curr_pic_ref_enabled_flag = get_bits1(gb);
15301530 if (pps->residual_adaptive_colour_transform_enabled_flag = get_bits1(gb)) {
15311531 pps->pps_slice_act_qp_offsets_present_flag = get_bits1(gb);
1532− pps->pps_act_y_qp_offset = get_se_golomb_long(gb) - 5;
1533− pps->pps_act_cb_qp_offset = get_se_golomb_long(gb) - 5;
1534− pps->pps_act_cr_qp_offset = get_se_golomb_long(gb) - 3;
1532+ pps->pps_act_y_qp_offset = get_se_golomb(gb) - 5;
1533+ pps->pps_act_cb_qp_offset = get_se_golomb(gb) - 5;
1534+ pps->pps_act_cr_qp_offset = get_se_golomb(gb) - 3;
15351535
15361536 #define CHECK_QP_OFFSET(name) (pps->pps_act_ ## name ## _qp_offset <= -12 || \
15371537 pps->pps_act_ ## name ## _qp_offset >= 12)

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