[FFmpeg-cvslog] r12315 - trunk/libavcodec/apedec.c
michael
subversion
Tue Mar 4 22:39:22 CET 2008
Author: michael
Date: Tue Mar 4 22:39:21 2008
New Revision: 12315
Log:
Prevent segfault due to reading over the end of the input buffer.
Modified:
trunk/libavcodec/apedec.c
Modified: trunk/libavcodec/apedec.c
==============================================================================
--- trunk/libavcodec/apedec.c (original)
+++ trunk/libavcodec/apedec.c Tue Mar 4 22:39:21 2008
@@ -256,7 +256,10 @@ static inline void range_start_decoding(
static inline void range_dec_normalize(APEContext * ctx)
{
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.range <<= 8;
}
More information about the ffmpeg-cvslog
mailing list