segfault fix
Originally committed as revision 4531 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
2185824b10
commit
1cd89f276a
@ -198,6 +198,8 @@ static int pnm_decode_frame(AVCodecContext *avctx,
|
|||||||
do_read:
|
do_read:
|
||||||
ptr = p->data[0];
|
ptr = p->data[0];
|
||||||
linesize = p->linesize[0];
|
linesize = p->linesize[0];
|
||||||
|
if(s->bytestream + n*avctx->height > s->bytestream_end)
|
||||||
|
return -1;
|
||||||
for(i = 0; i < avctx->height; i++) {
|
for(i = 0; i < avctx->height; i++) {
|
||||||
memcpy(ptr, s->bytestream, n);
|
memcpy(ptr, s->bytestream, n);
|
||||||
s->bytestream += n;
|
s->bytestream += n;
|
||||||
@ -211,6 +213,8 @@ static int pnm_decode_frame(AVCodecContext *avctx,
|
|||||||
n = avctx->width;
|
n = avctx->width;
|
||||||
ptr = p->data[0];
|
ptr = p->data[0];
|
||||||
linesize = p->linesize[0];
|
linesize = p->linesize[0];
|
||||||
|
if(s->bytestream + n*avctx->height*3/2 > s->bytestream_end)
|
||||||
|
return -1;
|
||||||
for(i = 0; i < avctx->height; i++) {
|
for(i = 0; i < avctx->height; i++) {
|
||||||
memcpy(ptr, s->bytestream, n);
|
memcpy(ptr, s->bytestream, n);
|
||||||
s->bytestream += n;
|
s->bytestream += n;
|
||||||
@ -233,6 +237,8 @@ static int pnm_decode_frame(AVCodecContext *avctx,
|
|||||||
case PIX_FMT_RGBA32:
|
case PIX_FMT_RGBA32:
|
||||||
ptr = p->data[0];
|
ptr = p->data[0];
|
||||||
linesize = p->linesize[0];
|
linesize = p->linesize[0];
|
||||||
|
if(s->bytestream + avctx->width*avctx->height*4 > s->bytestream_end)
|
||||||
|
return -1;
|
||||||
for(i = 0; i < avctx->height; i++) {
|
for(i = 0; i < avctx->height; i++) {
|
||||||
int j, r, g, b, a;
|
int j, r, g, b, a;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user