summaryrefslogtreecommitdiff
path: root/libavcodec/sunrast.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-29 13:18:54 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-05 14:37:52 +0200
commit02c19dfb8552cb40b02ff9c8d8d3c5e12d5c71e1 (patch)
treec68c32c81efc885d33c012e1c1425f28df9c4c71 /libavcodec/sunrast.c
parent8a9eac7e42f3bec34dadc4299446a9a9c9304231 (diff)
avcodec/sunrast: Use ptrdiff_t for stride
Fixes segfaults with negative linesizes; in particular, this affected the sunraster-(1|8|24)bit-(raw|rle) and sunraster-8bit_gray-raw FATE tests. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/sunrast.c')
-rw-r--r--libavcodec/sunrast.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index 77feef06e1..45b29e4d72 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -31,7 +31,8 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
{
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = avpkt->data + avpkt->size;
- unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
+ unsigned int w, h, depth, type, maptype, maplength, x, y, len, alen;
+ ptrdiff_t stride;
uint8_t *ptr, *ptr2 = NULL;
const uint8_t *bufstart = buf;
int ret;
@@ -141,7 +142,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (type == RT_BYTE_ENCODED) {
int value, run;
- uint8_t *end = ptr + h * stride;
+ uint8_t *end = ptr + (ptrdiff_t)h * stride;
x = 0;
while (ptr != end && buf < buf_end) {