cur_w > s->width - x_offset|| cur_h > s->height - y_offset)
return AVERROR_INVALIDDATA;
+ if (blend_op != APNG_BLEND_OP_OVER && blend_op != APNG_BLEND_OP_SOURCE) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid blend_op %d\n", blend_op);
+ return AVERROR_INVALIDDATA;
+ }
+
if (sequence_number == 0 && dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
// No previous frame to revert to for the first frame
// Spec says to just treat it as a APNG_DISPOSE_OP_BACKGROUND
AVFrame *p)
{
size_t x, y;
- uint8_t *buffer = av_malloc(s->image_linesize * s->height);
-
- if (!buffer)
- return AVERROR(ENOMEM);
+ uint8_t *buffer;
if (s->blend_op == APNG_BLEND_OP_OVER &&
avctx->pix_fmt != AV_PIX_FMT_RGBA &&
return AVERROR_PATCHWELCOME;
}
+ buffer = av_malloc_array(s->image_linesize, s->height);
+ if (!buffer)
+ return AVERROR(ENOMEM);
+
+
// Do the disposal operation specified by the last frame on the frame
if (s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);