targa: prevent integer overflow in bufsize check.

oldabi
Ronald S. Bultje 14 years ago
parent b3db9ceef1
commit 78e2380a6d
  1. 2
      libavcodec/targa.c

@ -34,7 +34,7 @@ typedef struct TargaContext {
} TargaContext; } TargaContext;
#define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \ #define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \
if(buf + needed > buf_end){ \ if(needed > buf_end - buf){ \
av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \ av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \
return -1; \ return -1; \
} \ } \

Loading…
Cancel
Save