History

swscale/rgb2rgb_template: Fix ff_rgb24toyv12_c() with odd height

Fixes: out of array access Fixes: 368143798/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6475823425585152

Michael Niedermayer committed 2 years ago

Commit 14f5d671 parent 08b1bff1 file · +6 −1Browse files

Unified · Split

libswscale/rgb2rgb_template.c+6−1
@@ -640,7 +640,7 @@ static inline void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst, · 639 unmodified lines
640640 }
641641
642642 /**
643− * Height should be a multiple of 2 and width should be a multiple of 2.
643+ * width should be a multiple of 2.
644644 * (If this is a problem for anyone then tell me, and I will fix it.)
645645 */
646646 void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
@@ -659,6 +659,11 @@ void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, · 12 unmodified lines
659659
660660 for (y = 0; y < height; y += 2) {
661661 int i;
662+ if (y + 1 == height) {
663+ ydst2 = ydst1;
664+ src2 = src1;
665+ }
666+
662667 for (i = 0; i < chromWidth; i++) {
663668 unsigned int b11 = src1[6 * i + 0];
664669 unsigned int g11 = src1[6 * i + 1];

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