File ffmpeg-CVE-2021-38094.patch of Package ffmpeg.27461
diff --unified --recursive --text --new-file --color ffmpeg-3.4.2.old/libavfilter/vf_convolution.c ffmpeg-3.4.2.new/libavfilter/vf_convolution.c
--- ffmpeg-3.4.2.old/libavfilter/vf_convolution.c 2021-10-13 13:48:52.898938526 +0800
+++ ffmpeg-3.4.2.new/libavfilter/vf_convolution.c 2021-10-13 14:15:29.703714372 +0800
@@ -173,18 +173,18 @@
line_copy16(p2, src, width, 1);
for (x = 0; x < width; x++) {
- int suma = p0[x - 1] * -1 +
- p0[x] * -1 +
- p0[x + 1] * -1 +
- p2[x - 1] * 1 +
- p2[x] * 1 +
- p2[x + 1] * 1;
- int sumb = p0[x - 1] * -1 +
- p0[x + 1] * 1 +
- p1[x - 1] * -1 +
- p1[x + 1] * 1 +
- p2[x - 1] * -1 +
- p2[x + 1] * 1;
+ float suma = p0[x - 1] * -1 +
+ p0[x] * -1 +
+ p0[x + 1] * -1 +
+ p2[x - 1] * 1 +
+ p2[x] * 1 +
+ p2[x + 1] * 1;
+ float sumb = p0[x - 1] * -1 +
+ p0[x + 1] * 1 +
+ p1[x - 1] * -1 +
+ p1[x + 1] * 1 +
+ p2[x - 1] * -1 +
+ p2[x + 1] * 1;
dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
}
@@ -230,10 +230,10 @@
line_copy16(p2, src, width, 1);
for (x = 0; x < width; x++) {
- int suma = p0[x - 1] * 1 +
- p1[x ] * -1;
- int sumb = p0[x ] * 1 +
- p1[x - 1] * -1;
+ float suma = p0[x - 1] * 1 +
+ p1[x ] * -1;
+ float sumb = p0[x ] * 1 +
+ p1[x - 1] * -1;
dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
}
@@ -279,18 +279,18 @@
line_copy16(p2, src, width, 1);
for (x = 0; x < width; x++) {
- int suma = p0[x - 1] * -1 +
- p0[x] * -2 +
- p0[x + 1] * -1 +
- p2[x - 1] * 1 +
- p2[x] * 2 +
- p2[x + 1] * 1;
- int sumb = p0[x - 1] * -1 +
- p0[x + 1] * 1 +
- p1[x - 1] * -2 +
- p1[x + 1] * 2 +
- p2[x - 1] * -1 +
- p2[x + 1] * 1;
+ float suma = p0[x - 1] * -1 +
+ p0[x] * -2 +
+ p0[x + 1] * -1 +
+ p2[x - 1] * 1 +
+ p2[x] * 2 +
+ p2[x + 1] * 1;
+ float sumb = p0[x - 1] * -1 +
+ p0[x + 1] * 1 +
+ p1[x - 1] * -2 +
+ p1[x + 1] * 2 +
+ p2[x - 1] * -1 +
+ p2[x + 1] * 1;
dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
}
@@ -335,18 +335,18 @@
line_copy8(p2, src, width, 1);
for (x = 0; x < width; x++) {
- int suma = p0[x - 1] * -1 +
- p0[x] * -1 +
- p0[x + 1] * -1 +
- p2[x - 1] * 1 +
- p2[x] * 1 +
- p2[x + 1] * 1;
- int sumb = p0[x - 1] * -1 +
- p0[x + 1] * 1 +
- p1[x - 1] * -1 +
- p1[x + 1] * 1 +
- p2[x - 1] * -1 +
- p2[x + 1] * 1;
+ float suma = p0[x - 1] * -1 +
+ p0[x] * -1 +
+ p0[x + 1] * -1 +
+ p2[x - 1] * 1 +
+ p2[x] * 1 +
+ p2[x + 1] * 1;
+ float sumb = p0[x - 1] * -1 +
+ p0[x + 1] * 1 +
+ p1[x - 1] * -1 +
+ p1[x + 1] * 1 +
+ p2[x - 1] * -1 +
+ p2[x + 1] * 1;
dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
}
@@ -391,10 +391,10 @@
line_copy8(p2, src, width, 1);
for (x = 0; x < width; x++) {
- int suma = p0[x - 1] * 1 +
- p1[x ] * -1;
- int sumb = p0[x ] * 1 +
- p1[x - 1] * -1;
+ float suma = p0[x - 1] * 1 +
+ p1[x ] * -1;
+ float sumb = p0[x ] * 1 +
+ p1[x - 1] * -1;
dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
}
@@ -439,18 +439,18 @@
line_copy8(p2, src, width, 1);
for (x = 0; x < width; x++) {
- int suma = p0[x - 1] * -1 +
- p0[x] * -2 +
- p0[x + 1] * -1 +
- p2[x - 1] * 1 +
- p2[x] * 2 +
- p2[x + 1] * 1;
- int sumb = p0[x - 1] * -1 +
- p0[x + 1] * 1 +
- p1[x - 1] * -2 +
- p1[x + 1] * 2 +
- p2[x - 1] * -1 +
- p2[x + 1] * 1;
+ float suma = p0[x - 1] * -1 +
+ p0[x] * -2 +
+ p0[x + 1] * -1 +
+ p2[x - 1] * 1 +
+ p2[x] * 2 +
+ p2[x + 1] * 1;
+ float sumb = p0[x - 1] * -1 +
+ p0[x + 1] * 1 +
+ p1[x - 1] * -2 +
+ p1[x + 1] * 2 +
+ p2[x - 1] * -1 +
+ p2[x + 1] * 1;
dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
}