aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mpc_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-12 07:14:18 +0100
committerMax Kellermann <max@duempel.org>2008-11-12 07:14:18 +0100
commiteff21067f0a3135242ecb9bfdc66e4b6f760089e (patch)
tree615c9ab15a6a234b100658aed727e033cc0bca6a /src/decoder/mpc_plugin.c
parent0a6f4048d07f3a5485ed1a8796896fbae3a99b8c (diff)
downloadmpd-eff21067f0a3135242ecb9bfdc66e4b6f760089e.tar.gz
mpd-eff21067f0a3135242ecb9bfdc66e4b6f760089e.tar.xz
mpd-eff21067f0a3135242ecb9bfdc66e4b6f760089e.zip
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.
Diffstat (limited to '')
-rw-r--r--src/decoder/mpc_plugin.c4
1 files changed, 2 insertions, 2 deletions
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;