[FFmpeg-cvslog] av_lzo1x_decode: properly handle negative buffer length.

Reimar Döffinger git at videolan.org
Sat Nov 5 23:54:34 CET 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sat Nov  5 21:45:31 2011 +0100| [b9242fd12f4be4a79e31fd0aa125ab8a48226896] | committer: Reimar Döffinger

av_lzo1x_decode: properly handle negative buffer length.

Treating them like 0 is safest, current code would invoke
undefined pointer arithmetic behaviour in this case.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9242fd12f4be4a79e31fd0aa125ab8a48226896
---

 libavutil/lzo.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/lzo.c b/libavutil/lzo.c
index bac762e..759a243 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;
     }



More information about the ffmpeg-cvslog mailing list