Mercurial > mplayer.hg
comparison libmpcodecs/ad_mpc.c @ 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 | 94568863c59c |
children | 65fb32defee5 |
comparison
equal
deleted
inserted
replaced
16467:b866f6be154a | 16468:0c22fbbbc2c7 |
---|---|
27 | 27 |
28 LIBAD_EXTERN(libmusepack) | 28 LIBAD_EXTERN(libmusepack) |
29 | 29 |
30 #include <mpcdec/mpcdec.h> | 30 #include <mpcdec/mpcdec.h> |
31 | 31 |
32 #define MAX_FRAMESIZE MPC_DECODER_BUFFER_LENGTH | 32 // BUFFER_LENGTH is in MPC_SAMPLE_FORMAT units |
33 #define MAX_FRAMESIZE (4 * MPC_DECODER_BUFFER_LENGTH) | |
33 | 34 |
34 typedef struct context_s { | 35 typedef struct context_s { |
35 char *header; | 36 char *header; |
36 int header_len; | 37 int header_len; |
37 sh_audio_t *sh; | 38 sh_audio_t *sh; |
153 int status, len; | 154 int status, len; |
154 MPC_SAMPLE_FORMAT *sample_buffer = (MPC_SAMPLE_FORMAT *)buf; | 155 MPC_SAMPLE_FORMAT *sample_buffer = (MPC_SAMPLE_FORMAT *)buf; |
155 mpc_uint32_t *packet = NULL; | 156 mpc_uint32_t *packet = NULL; |
156 | 157 |
157 context_t *cd = (context_t *) sh->context; | 158 context_t *cd = (context_t *) sh->context; |
158 if (maxlen < MPC_DECODER_BUFFER_LENGTH) { | 159 if (maxlen < MAX_FRAMESIZE) { |
159 mp_msg(MSGT_DECAUDIO, MSGL_ERR, "maxlen too small in decode_audio\n"); | 160 mp_msg(MSGT_DECAUDIO, MSGL_V, "maxlen too small in decode_audio\n"); |
160 return -1; | 161 return -1; |
161 } | 162 } |
162 len = ds_get_packet(sh->ds, (unsigned char **)&packet); | 163 len = ds_get_packet(sh->ds, (unsigned char **)&packet); |
163 if (len <= 0) return -1; | 164 if (len <= 0) return -1; |
164 status = mpc_decoder_decode_frame(&cd->decoder, packet, len, sample_buffer); | 165 status = mpc_decoder_decode_frame(&cd->decoder, packet, len, sample_buffer); |