This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/9.1 in repository ffmpeg.
commit 15d9f370d3983295668a6e5541c81e6ff14b9183 Author: Michael Niedermayer <[email protected]> AuthorDate: Thu Nov 12 05:17:25 2026 +0100 Commit: Michael Niedermayer <[email protected]> CommitDate: Thu Nov 19 14:55:53 2026 +0100 swscale/output: do not store past an odd width in the 16 bit RGB C functions Fixes: out of array write Fixes: bKTdZBAokzK8 Fixes: sws_565_exact.c Fixes: sws_full_sweep.c Out of array write Replicated through API with Valgrind Found-by: Kim Jeongsu with StealthMole (cherry picked from commit 82538d0846a469fbe2d99bfd2c8a6b6201c1aa2e) Signed-off-by: Michael Niedermayer <[email protected]> --- libswscale/output.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libswscale/output.c b/libswscale/output.c index d32ac8ce38..b2e26f7048 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1664,7 +1664,7 @@ YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 0, * correct RGB values into the destination buffer. */ static av_always_inline void -yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, +yuv2rgb_write(uint8_t *_dest, int i, int dstW, int Y1, int Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum AVPixelFormat target, int hasAlpha) @@ -1748,7 +1748,10 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; - dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; + /* these formats have no full chroma interpolation and so are + * output in pairs for odd widths too */ + if (i * 2 + 1 < dstW) + dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; @@ -1838,7 +1841,7 @@ yuv2rgb_X_c_template(SwsInternal *c, const int16_t *lumFilter, g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]); b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; - yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, + yuv2rgb_write(dest, i, dstW, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } @@ -1878,7 +1881,7 @@ yuv2rgb_2_c_template(SwsInternal *c, const int16_t *buf[2], A2 = av_clip_uint8(A2); } - yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, + yuv2rgb_write(dest, i, dstW, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } @@ -1911,7 +1914,7 @@ yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0, A2 = av_clip_uint8(A2); } - yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, + yuv2rgb_write(dest, i, dstW, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } else { @@ -1936,7 +1939,7 @@ yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0, A2 = av_clip_uint8(A2); } - yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, + yuv2rgb_write(dest, i, dstW, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
