Skip to content
Snippets Groups Projects
Commit efd6cbc5 authored by Stefano Sabatini's avatar Stefano Sabatini
Browse files

flicvideo: fix crash on flic files with invalid frame size


Add a check in flic_decode_frame_8BPP(), in case chunk_size is >
frame_size issue a warning and resize chunk_size to frame_size, in
order to avoid out-of-buffer reads.

Fix roundup issue #2520, trac issue #69.

Signed-off-by: default avatarStefano Sabatini <stefano.sabatini-lala@poste.it>
parent cd187279
No related branches found
No related tags found
No related merge requests found
...@@ -181,6 +181,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, ...@@ -181,6 +181,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
/* iterate through the chunks */ /* iterate through the chunks */
while ((frame_size > 0) && (num_chunks > 0)) { while ((frame_size > 0) && (num_chunks > 0)) {
chunk_size = AV_RL32(&buf[stream_ptr]); chunk_size = AV_RL32(&buf[stream_ptr]);
if (chunk_size > frame_size) {
av_log(avctx, AV_LOG_WARNING,
"Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size);
chunk_size = frame_size;
}
stream_ptr += 4; stream_ptr += 4;
chunk_type = AV_RL16(&buf[stream_ptr]); chunk_type = AV_RL16(&buf[stream_ptr]);
stream_ptr += 2; stream_ptr += 2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment