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
1211 for (i = 0; i < ((dstW + 1) >> 1); i++) {1211 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1212 SUINT Y1 = (buf0[i * 2] ) >> 2;1212 SUINT Y1 = (buf0[i * 2] ) >> 2;
1213 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;1213 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1214 int U = (ubuf0[i] - (128 << 11)) >> 2;1214 SUINT U = (ubuf0[i] - (128 << 11)) >> 2;
1215 int V = (vbuf0[i] - (128 << 11)) >> 2;1215 SUINT V = (vbuf0[i] - (128 << 11)) >> 2;
1216 int R, G, B;1216 int R, G, B;
1217 1217
1218 Y1 -= c->yuv2rgb_y_offset;1218 Y1 -= c->yuv2rgb_y_offset;
@@ -1260,8 +1260,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, · 41 unmodified lines
1260 for (i = 0; i < ((dstW + 1) >> 1); i++) {1260 for (i = 0; i < ((dstW + 1) >> 1); i++) {
1261 SUINT Y1 = (buf0[i * 2] ) >> 2;1261 SUINT Y1 = (buf0[i * 2] ) >> 2;
1262 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;1262 SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1263 int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;1263 SUINT U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
1264 int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;1264 SUINT V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;
1265 int R, G, B;1265 int R, G, B;
1266 1266
1267 Y1 -= c->yuv2rgb_y_offset;1267 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