Prevent segfault due to reading over the end of the input buffer.
Originally committed as revision 12315 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7998988129
commit
1a2a1d9077
@ -256,7 +256,10 @@ static inline void range_start_decoding(APEContext * ctx)
|
|||||||
static inline void range_dec_normalize(APEContext * ctx)
|
static inline void range_dec_normalize(APEContext * ctx)
|
||||||
{
|
{
|
||||||
while (ctx->rc.range <= BOTTOM_VALUE) {
|
while (ctx->rc.range <= BOTTOM_VALUE) {
|
||||||
ctx->rc.buffer = (ctx->rc.buffer << 8) | bytestream_get_byte(&ctx->ptr);
|
ctx->rc.buffer <<= 8;
|
||||||
|
if(ctx->ptr < ctx->data_end)
|
||||||
|
ctx->rc.buffer += *ctx->ptr;
|
||||||
|
ctx->ptr++;
|
||||||
ctx->rc.low = (ctx->rc.low << 8) | ((ctx->rc.buffer >> 1) & 0xFF);
|
ctx->rc.low = (ctx->rc.low << 8) | ((ctx->rc.buffer >> 1) & 0xFF);
|
||||||
ctx->rc.range <<= 8;
|
ctx->rc.range <<= 8;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user