aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-15 17:19:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-15 17:19:32 +0100
commitd46ef40129487143f2fa4e0b44b3f5e788c4fcb2 (patch)
tree040c8e87d1c31779bdba412544e42fee3f15ae3a /libavcodec
parented1a6878564a97e67e5fe3a25bc099208cfed024 (diff)
downloadffmpeg-d46ef40129487143f2fa4e0b44b3f5e788c4fcb2.tar.gz
avcodec/fic: fix slice checks
fix integer overflows Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/fic.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index fc0c2a536f..c4f262da6a 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -214,8 +214,8 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
}
for (slice = 0; slice < nslices; slice++) {
- int slice_off = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
- int slice_size;
+ unsigned slice_off = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
+ unsigned slice_size;
int y_off = ctx->slice_h * slice;
int slice_h = ctx->slice_h;
@@ -230,11 +230,11 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
}
- slice_size -= slice_off;
-
- if (slice_off > msize || slice_off + slice_size > msize)
+ if (slice_size < slice_off || slice_size > msize)
continue;
+ slice_size -= slice_off;
+
ctx->slice_data[slice].src = sdata + slice_off;
ctx->slice_data[slice].src_size = slice_size;
ctx->slice_data[slice].slice_h = slice_h;