Skip to content
Snippets Groups Projects
Commit 9bd6375d authored by Anton Khirnov's avatar Anton Khirnov
Browse files

msrledec: check bounds before constructing a possibly invalid pointer,

CC:libav-stable@libav.org
parent 6a399854
No related branches found
No related tags found
No related merge requests found
...@@ -144,8 +144,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, ...@@ -144,8 +144,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
if(p1 == 0) { //Escape code if(p1 == 0) { //Escape code
p2 = bytestream2_get_byte(gb); p2 = bytestream2_get_byte(gb);
if(p2 == 0) { //End-of-line if(p2 == 0) { //End-of-line
output = pic->data[0] + (--line) * pic->linesize[0]; if (--line < 0) {
if (line < 0) {
if (bytestream2_get_be16(gb) == 1) { // end-of-picture if (bytestream2_get_be16(gb) == 1) { // end-of-picture
return 0; return 0;
} else { } else {
...@@ -155,6 +154,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, ...@@ -155,6 +154,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} }
output = pic->data[0] + line * pic->linesize[0];
pos = 0; pos = 0;
continue; continue;
} else if(p2 == 1) { //End-of-picture } else if(p2 == 1) { //End-of-picture
......
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