summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/eamad.c15
-rw-r--r--libavcodec/libmp3lame.c2
-rw-r--r--libavcodec/png.c4
-rw-r--r--libavcodec/wmadec.c5
-rw-r--r--libavcodec/wmaprodec.c5
-rw-r--r--libavcodec/xxan.c2
6 files changed, 28 insertions, 5 deletions
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 2f9559fe8e..e71bf9adb3 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -276,6 +276,21 @@ static int decode_frame(AVCodecContext *avctx,
}
}
+ if (inter && !s->last_frame.data[0]) {
+ int ret;
+ av_log(avctx, AV_LOG_WARNING, "Missing reference frame.\n");
+ s->last_frame.reference = 1;
+ ret = ff_get_buffer(avctx, &s->last_frame);
+ if (ret < 0)
+ return ret;
+ memset(s->last_frame.data[0], 0, s->last_frame.height *
+ s->last_frame.linesize[0]);
+ memset(s->last_frame.data[1], 0x80, s->last_frame.height / 2 *
+ s->last_frame.linesize[1]);
+ memset(s->last_frame.data[2], 0x80, s->last_frame.height / 2 *
+ s->last_frame.linesize[2]);
+ }
+
av_fast_padded_malloc(&s->bitstream_buf, &s->bitstream_buf_size,
buf_end - buf);
if (!s->bitstream_buf)
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index 034fee73a9..eea9d031b1 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -218,7 +218,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
} else {
lame_result = lame_encode_flush(s->gfp, s->buffer + s->buffer_index,
- BUFFER_SIZE - s->buffer_index);
+ s->buffer_size - s->buffer_index);
}
if (lame_result < 0) {
if (lame_result == -1) {
diff --git a/libavcodec/png.c b/libavcodec/png.c
index a4287bd7e2..b398d91000 100644
--- a/libavcodec/png.c
+++ b/libavcodec/png.c
@@ -38,9 +38,7 @@ static const uint8_t ff_png_pass_xshift[NB_PASSES] = {
void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
{
- if(items >= UINT_MAX / size)
- return NULL;
- return av_malloc(items * size);
+ return av_mallocz_array(items, size);
}
void ff_png_zfree(void *opaque, void *ptr)
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 48d52fdc05..613a434ab1 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -72,6 +72,11 @@ static int wma_decode_init(AVCodecContext * avctx)
int i, flags2;
uint8_t *extradata;
+ if (!avctx->block_align) {
+ av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
+ return AVERROR(EINVAL);
+ }
+
s->avctx = avctx;
/* extract flag infos */
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index a1d85f4c4b..f6a11e3e14 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -280,6 +280,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
int log2_max_num_subframes;
int num_possible_block_sizes;
+ if (!avctx->block_align) {
+ av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
+ return AVERROR(EINVAL);
+ }
+
s->avctx = avctx;
ff_dsputil_init(&s->dsp, avctx);
avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index 2476f5dea1..1deafe8bcc 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -315,7 +315,7 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
int dec_size;
bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET);
- dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size);
+ dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size / 2);
if (dec_size < 0)
dec_size = 0;
else