diff options
author | Jeremy Leconte <jleconte@google.com> | 2020-12-24 04:27:19 +0000 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-12-24 15:27:56 +0100 |
commit | 29cef1bcd6baf4394a24b34bfbec59e97bb3875b (patch) | |
tree | 2cc7e9c82aee2214b51c867cc0e86419d737258d /libswscale/swscale_unscaled.c | |
parent | aea8d4061d3e662b506df8067b7584dbab0a1851 (diff) | |
download | ffmpeg-29cef1bcd6baf4394a24b34bfbec59e97bb3875b.tar.gz |
libswscale: avoid UB nullptr-with-offset.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale/swscale_unscaled.c')
-rw-r--r-- | libswscale/swscale_unscaled.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 563de39696..7e92f3fafc 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1805,7 +1805,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); int plane, i, j; - for (plane = 0; plane < 4; plane++) { + for (plane = 0; plane < 4 && dst[plane] != NULL; plane++) { int length = (plane == 0 || plane == 3) ? c->srcW : AV_CEIL_RSHIFT(c->srcW, c->chrDstHSubSample); int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample); int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample); @@ -1813,8 +1813,6 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], uint8_t *dstPtr = dst[plane] + dstStride[plane] * y; int shiftonly = plane == 1 || plane == 2 || (!c->srcRange && plane == 0); - if (!dst[plane]) - continue; // ignore palette for GRAY8 if (plane == 1 && !dst[2]) continue; if (!src[plane] || (plane == 1 && !src[2])) { |