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.
This commit is contained in:
Max Kellermann 2008-11-12 07:14:18 +01:00
parent 0a6f4048d0
commit eff21067f0

View File

@ -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;