From 2b53e696c864c4ade3c38707f8595e17a998bedc Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 10 Dec 2011 12:55:08 +0100 Subject: ptx: emit a warning on insufficient picture data Return the whole packet as consumed in this case and not the size the packet should have had. Move the insufficient data check into the for condition to fix a ISO C90 error on bigendian. --- libavcodec/ptx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libavcodec/ptx.c') 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; } -- cgit v1.2.3 From 8d61eef917f736ebd4bc23c36d1b0cb3934e7dd6 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 10 Dec 2011 16:57:32 +0100 Subject: ptx: fix inverted check for sufficient data Fix regression introduced in 2b53e69. --- libavcodec/ptx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/ptx.c') diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 75b42d5073..fd4933c1d6 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -84,7 +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; y < h && buf_end - buf < w * bytes_per_pixel; y++) { + for (y = 0; y < h && buf_end - buf >= w * bytes_per_pixel; y++) { #if HAVE_BIGENDIAN unsigned int x; for (x=0; x