History

avcodec/osq: Fixes several undefined overflows in do_decode()

Fixes: signed integer overflow: 1239596184 + 2119376059 cannot be represented in type 'int' Fixes: 376136844/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6581164455821312

Michael Niedermayer committed 1 year ago

Commit 0f511b41 parent 56faee21 file · +3 −3Browse files

Unified · Split

libavcodec/osq.c+3−3
@@ -300,7 +300,7 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int · 299 unmodified lines
300300 dst[n] += (int)(P2 + P3) / 2 + (unsigned)p;
301301 break;
302302 case 8:
303− dst[n] += (int)(P2 + P3) / 2;
303+ dst[n] += (int)(P2 + P3) / 2 + 0U;
304304 break;
305305 case 9:
306306 dst[n] += (int)(P2 * 2 + P3) / 3 + (unsigned)p;
@@ -309,13 +309,13 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int · 2 unmodified lines
309309 dst[n] += (int)(P2 + P3 * 2) / 3 + (unsigned)p;
310310 break;
311311 case 11:
312− dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2;
312+ dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2 + 0U;
313313 break;
314314 case 12:
315315 dst[n] += (unsigned)dst[B];
316316 break;
317317 case 13:
318− dst[n] += (int)(unsigned)(dst[D] + dst[B]) / 2;
318+ dst[n] += (int)((unsigned)dst[D] + dst[B]) / 2 + 0U;
319319 break;
320320 case 14:
321321 dst[n] += (int)((unsigned)P2 + dst[A]) / 2 + (unsigned)p;

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