aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-23 14:45:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-25 16:35:25 +0200
commit4a237657047b8c2404858417e79a5548fac7cbe8 (patch)
tree5d652d1bee033de1ea8592d50822e3fa688c1502 /libavutil
parent083d0b7b2d928185d7cadff7b4f558c8d8557939 (diff)
downloadffmpeg-4a237657047b8c2404858417e79a5548fac7cbe8.tar.gz
avutil/lzo: add asserts to be double sure against overflows
These asserts cannot fail since d6af26c55c1ea30f85a7d9edbc373f53be1743ee Based-on: ccda51b14c0fcae2fad73a24872dce75a7964996 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit cf2b7c01f81c1fb3283a1390c0ca9a2f81f4f4a8) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/lzo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavutil/lzo.c b/libavutil/lzo.c
index 82dba94771..6104fc3085 100644
--- a/libavutil/lzo.c
+++ b/libavutil/lzo.c
@@ -22,6 +22,7 @@
#include <string.h>
#include "avutil.h"
+#include "avassert.h"
#include "common.h"
#include "intreadwrite.h"
#include "lzo.h"
@@ -85,6 +86,7 @@ static inline void copy(LZOContext *c, int cnt)
{
register const uint8_t *src = c->in;
register uint8_t *dst = c->out;
+ av_assert0(cnt >= 0);
if (cnt > c->in_end - src) {
cnt = FFMAX(c->in_end - src, 0);
c->error |= AV_LZO_INPUT_DEPLETED;
@@ -116,6 +118,7 @@ static inline void copy(LZOContext *c, int cnt)
static inline void copy_backptr(LZOContext *c, int back, int cnt)
{
register uint8_t *dst = c->out;
+ av_assert0(cnt > 0);
if (dst - c->out_start < back) {
c->error |= AV_LZO_INVALID_BACKPTR;
return;