[FFmpeg-devel] [FFmpeg-commits] targa: fix potential buffer overreads

Ronald S. Bultje rsbultje
Fri Feb 18 23:16:34 CET 2011


Hi,

On Fri, Feb 18, 2011 at 10:09 AM, Jean-Daniel Dupas <git at ffmpeg.org> wrote:
> -static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp)
> +#define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \
> + ? ?if(buf + needed > buf_end){ \
> + ? ? ? ?av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \
> + ? ? ? ?return -1; \
> + ? ?} \

Didn't Reimar just say this should be needed > buf_end - buf to
prevent overflows? This looks wrong.

Ronald



More information about the ffmpeg-devel mailing list