1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-06 09:35:43 +02:00

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.
This commit is contained in:
Janne Grunau 2011-12-10 12:55:08 +01:00
parent 97334f106c
commit 2b53e696c8

View File

@ -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; y<h; y++) {
if (buf_end - buf < w * bytes_per_pixel)
break;
for (y = 0; y < h && buf_end - buf < w * bytes_per_pixel; y++) {
#if HAVE_BIGENDIAN
unsigned int x;
for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
@ -101,6 +99,11 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
*picture = s->picture;
*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;
}