diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index eee0d58994..75b42d5073 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -84,9 +84,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ptr = p->data[0]; stride = p->linesize[0]; - for (y=0; ypicture; *data_size = sizeof(AVPicture); + if (y < h) { + av_log(avctx, AV_LOG_WARNING, "incomplete packet\n"); + return avpkt->size; + } + return offset + w*h*bytes_per_pixel; }