From eff21067f0a3135242ecb9bfdc66e4b6f760089e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 12 Nov 2008 07:14:18 +0100 Subject: mpc: assume the result fo of mpc_decoder_decode() is unsigned According to the documentation, mpc_decoder_decode() returns an mpc_uint32_t. Since the special return value (mpc_uint32_t)-1 translates to a very large long integer, this may cause segmentation faults if not interpreted properly. --- src/decoder/mpc_plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/decoder/mpc_plugin.c') diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c index c55875a3f..4d5f0b8b3 100644 --- a/src/decoder/mpc_plugin.c +++ b/src/decoder/mpc_plugin.c @@ -115,7 +115,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH]; - long ret; + mpc_uint32_t ret; int32_t chunk[G_N_ELEMENTS(sample_buffer)]; long bitRate = 0; unsigned long samplePos = 0; @@ -179,7 +179,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) vbrUpdateBits = 0; ret = mpc_decoder_decode(&decoder, sample_buffer, &vbrUpdateAcc, &vbrUpdateBits); - if (ret <= 0) + if (ret == 0 || ret == (mpc_uint32_t)-1) break; samplePos += ret; -- cgit v1.2.3