History

swscale/output: Fix integer overflows in yuv2rgba64_1_c_template()

Fixes: signed integer overflow: -132524 * 16525 cannot be represented in type 'int' Fixes: 414862270/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4869083202125824

Michael Niedermayer committed 1 year ago

Commit 38ead081 parent 67559761 file · +4 −4Browse files

Unified · Split

libswscale/output.c+4−4
@@ -1211,8 +1211,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, · 1210 unmodified lines
12111211 for (i = 0; i < ((dstW + 1) >> 1); i++) {
12121212 SUINT Y1 = (buf0[i * 2] ) >> 2;
12131213 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1214− int U = (ubuf0[i] - (128 << 11)) >> 2;
1215− int V = (vbuf0[i] - (128 << 11)) >> 2;
1214+ SUINT U = (ubuf0[i] - (128 << 11)) >> 2;
1215+ SUINT V = (vbuf0[i] - (128 << 11)) >> 2;
12161216 int R, G, B;
12171217
12181218 Y1 -= c->yuv2rgb_y_offset;
@@ -1260,8 +1260,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, · 41 unmodified lines
12601260 for (i = 0; i < ((dstW + 1) >> 1); i++) {
12611261 SUINT Y1 = (buf0[i * 2] ) >> 2;
12621262 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1263− int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
1264− int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;
1263+ SUINT U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
1264+ SUINT V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;
12651265 int R, G, B;
12661266
12671267 Y1 -= c->yuv2rgb_y_offset;

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