diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index e8574c10e2e539df25594190f9e3f5220f3df7d8..cef479641129595452fa14139d579b85ec346a2a 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -619,7 +619,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
     /* decode audio chunks */
     if (audio_chunks > 0) {
         buf_end = buf + buf_size;
-        while ( buf_end - buf >= s->chunk_size) {
+        while (buf_end - buf >= s->chunk_size) {
             if (s->out_bps == 2) {
                 decode_audio_s16(output_samples_s16, buf, s->chunk_size,
                                  avctx->channels);
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index afe4661c6b0efb5235b24fbc1e6c00592a9cc9a4..9a8158f29240f29d1fb9287710acd3fcb815b5e1 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1513,8 +1513,11 @@ static int decode_packet(AVCodecContext *avctx, void *data,
         s->packet_done = 0;
 
         /** sanity check for the buffer length */
-        if (buf_size < avctx->block_align)
-            return 0;
+        if (buf_size < avctx->block_align) {
+            av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
+                   buf_size, avctx->block_align);
+            return AVERROR_INVALIDDATA;
+        }
 
         s->next_packet_start = buf_size - avctx->block_align;
         buf_size = avctx->block_align;