From b9242fd12f4be4a79e31fd0aa125ab8a48226896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 5 Nov 2011 21:45:31 +0100 Subject: av_lzo1x_decode: properly handle negative buffer length. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Treating them like 0 is safest, current code would invoke undefined pointer arithmetic behaviour in this case. Signed-off-by: Reimar Döffinger --- libavutil/lzo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavutil/lzo.c') diff --git a/libavutil/lzo.c b/libavutil/lzo.c index bac762ecc3..759a2433b8 100644 --- a/libavutil/lzo.c +++ b/libavutil/lzo.c @@ -175,11 +175,11 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) { int state= 0; int x; LZOContext c; - if (!*outlen || !*inlen) { + if (*outlen <= 0 || *inlen <= 0) { int res = 0; - if (!*outlen) + if (*outlen <= 0) res |= AV_LZO_OUTPUT_FULL; - if (!*inlen) + if (*inlen <= 0) res |= AV_LZO_INPUT_DEPLETED; return res; } -- cgit v1.2.3