diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-06-09 16:31:28 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-07-07 23:36:30 +0200 |
commit | 66b60bae68a3124fb176b0c2d4580f0f76c31dc4 (patch) | |
tree | c6623f1fa7560da192e254da15f0b2ea6e0b0d1a | |
parent | 62d4414d54f57612ac444643a92de7d10455b6c6 (diff) | |
download | ffmpeg-66b60bae68a3124fb176b0c2d4580f0f76c31dc4.tar.gz |
swscale/swscale: Use ptrdiff_t for linesize computations
This is unlikely to make a difference
Fixes: CID1591896 Unintentional integer overflow
Fixes: CID1591901 Unintentional integer overflow
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libswscale/swscale.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 9736734881..df0d5708aa 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1175,7 +1175,7 @@ int sws_receive_slice(struct SwsContext *c, unsigned int slice_start, } for (int i = 0; i < FF_ARRAY_ELEMS(dst); i++) { - ptrdiff_t offset = c->frame_dst->linesize[i] * (slice_start >> c->chrDstVSubSample); + ptrdiff_t offset = c->frame_dst->linesize[i] * (ptrdiff_t)(slice_start >> c->chrDstVSubSample); dst[i] = FF_PTR_ADD(c->frame_dst->data[i], offset); } @@ -1236,7 +1236,7 @@ void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, for (int i = 0; i < FF_ARRAY_ELEMS(dst) && parent->frame_dst->data[i]; i++) { const int vshift = (i == 1 || i == 2) ? c->chrDstVSubSample : 0; const ptrdiff_t offset = parent->frame_dst->linesize[i] * - ((slice_start + parent->dst_slice_start) >> vshift); + (ptrdiff_t)((slice_start + parent->dst_slice_start) >> vshift); dst[i] = parent->frame_dst->data[i] + offset; } |