changeset 16468:0c22fbbbc2c7

Fix maximum frame size, could lead to crashes when changing playback speed.
author reimar
date Mon, 12 Sep 2005 21:08:04 +0000
parents b866f6be154a
children 8c1c8d10c163
files libmpcodecs/ad_mpc.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_mpc.c	Mon Sep 12 20:37:53 2005 +0000
+++ b/libmpcodecs/ad_mpc.c	Mon Sep 12 21:08:04 2005 +0000
@@ -29,7 +29,8 @@
 
 #include <mpcdec/mpcdec.h>
 
-#define MAX_FRAMESIZE MPC_DECODER_BUFFER_LENGTH
+// BUFFER_LENGTH is in MPC_SAMPLE_FORMAT units
+#define MAX_FRAMESIZE (4 * MPC_DECODER_BUFFER_LENGTH)
 
 typedef struct context_s {
   char *header;
@@ -155,8 +156,8 @@
   mpc_uint32_t *packet = NULL;
   
   context_t *cd = (context_t *) sh->context;
-  if (maxlen < MPC_DECODER_BUFFER_LENGTH) {
-    mp_msg(MSGT_DECAUDIO, MSGL_ERR, "maxlen too small in decode_audio\n");
+  if (maxlen < MAX_FRAMESIZE) {
+    mp_msg(MSGT_DECAUDIO, MSGL_V, "maxlen too small in decode_audio\n");
     return -1;
   }
   len = ds_get_packet(sh->ds, (unsigned char **)&packet);