History

avcodec/aac/aacdec_lpd: Limit get_unary()

The limit is based on later code storing 32bits Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 393164866/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-4606798354513920

Michael Niedermayer committed 1 year ago

Commit 464fb861 parent 41cd72d1 file · +6 −3Browse files

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

Unified · Split

libavcodec/aac/aacdec_lpd.c+6−3
@@ -62,7 +62,7 @@ static void parse_qn(GetBitContext *gb, int *qn, int nk_mode, int no_qn) · 61 unmodified lines
6262 {
6363 if (nk_mode == 1) {
6464 for (int k = 0; k < no_qn; k++) {
65− qn[k] = get_unary(gb, 0, INT32_MAX); // TODO: find proper ranges
65+ qn[k] = get_unary(gb, 0, 68); // TODO: find proper ranges
6666 if (qn[k])
6767 qn[k]++;
6868 }
@@ -75,7 +75,7 @@ static void parse_qn(GetBitContext *gb, int *qn, int nk_mode, int no_qn) · 6 unmodified lines
7575 if (nk_mode == 2) {
7676 for (int k = 0; k < no_qn; k++) {
7777 if (qn[k] > 4) {
78− qn[k] = get_unary(gb, 0, INT32_MAX);;
78+ qn[k] = get_unary(gb, 0, 65);
7979 if (qn[k])
8080 qn[k] += 4;
8181 }
@@ -85,7 +85,7 @@ static void parse_qn(GetBitContext *gb, int *qn, int nk_mode, int no_qn) · 3 unmodified lines
8585
8686 for (int k = 0; k < no_qn; k++) {
8787 if (qn[k] > 4) {
88− int qn_ext = get_unary(gb, 0, INT32_MAX);;
88+ int qn_ext = get_unary(gb, 0, 65);
8989 switch (qn_ext) {
9090 case 0: qn[k] = 5; break;
9191 case 1: qn[k] = 6; break;
@@ -114,6 +114,9 @@ static int parse_codebook_idx(GetBitContext *gb, uint32_t *kv, · 22 unmodified lines
114114 }
115115 }
116116
117+ if (nk > 25)
118+ return AVERROR_PATCHWELCOME;
119+
117120 skip_bits(gb, 4*n);
118121
119122 if (nk > 0)

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