History

swscale/swscale: Use unsigned operation to avoid undefined behavior

I have not checked that the constant is correct, this just fixes the undefined behavior Fixes: signed integer overflow: -646656 * 3517 cannot be represented in type 'int Fixes: 70559/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5209368631508992

Michael Niedermayer committed 2 years ago

Commit 44c56411 parent 6df9a021 file · +1 −1Browse files

Unified · Split

libswscale/swscale.c+1−1
@@ -224,7 +224,7 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width) · 223 unmodified lines
224224 int i;
225225 int32_t *dst = (int32_t *) _dst;
226226 for (i = 0; i < width; i++)
227− dst[i] = (dst[i]*(14071/4) + (33561947<<4)/4)>>12;
227+ dst[i] = ((int)(dst[i]*(14071U/4) + (33561947<<4)/4)) >> 12;
228228 }
229229
230230

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