uint32_t pal[256];
} QpegContext;
-static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
+static int qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
int stride, int width, int height)
{
int i;
}
} else {
size -= copy;
+ if (size<0)
+ return AVERROR_INVALIDDATA;
for(i = 0; i < copy; i++) {
dst[filled++] = *src++;
if (filled >= width) {
}
}
}
+ return 0;
}
static const int qpeg_table_h[16] =
AVFrame * p= (AVFrame*)&a->pic;
AVFrame * ref= (AVFrame*)&a->ref;
uint8_t* outdata;
- int delta;
+ int delta, ret = 0;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
if(ref->data[0])
}
outdata = a->pic.data[0];
if(buf[0x85] == 0x10) {
- qpeg_decode_intra(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height);
+ ret = qpeg_decode_intra(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height);
} else {
delta = buf[0x85];
qpeg_decode_inter(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height, delta, buf + 4, a->ref.data[0]);
}
+ if (ret<0)
+ return ret;
+
/* make the palette available on the way out */
if (pal) {
a->pic.palette_has_changed = 1;