lzo: fix overflow checking in copy_backptr()
authorXi Wang <xi.wang@gmail.com>
Fri, 15 Mar 2013 10:59:22 +0000 (06:59 -0400)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 23 Jun 2014 16:17:42 +0000 (18:17 +0200)
commit9ade5b804ea1ff98971972769c43497a597b0e77
tree2c7ef08ba925a7dcb520250e481398fa89583853
parent753f0738cae926be97c8b853f2bb5b325ceaa612
lzo: fix overflow checking in copy_backptr()

The check `src > dst' in the form `&c->out[-back] > c->out' invokes
pointer overflow, which is undefined behavior in C.

Remove the check.  Also replace `&c->out[-back] < c->out_start' with
a safe form `c->out - c->out_start < back' to avoid overflow.

CC: libav-stable@libav.org
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ca6c3f2c53be70aa3c38e8f1292809db89ea1ba6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/lzo.c