rtmp: fix multiple broken overflow checks
authorXi Wang <xi.wang@gmail.com>
Tue, 22 Jan 2013 22:49:29 +0000 (17:49 -0500)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Feb 2013 14:18:23 +0000 (15:18 +0100)
commit69b3fedc09d93ddf8041a5383435e7f4943ceadc
tree4492b9412351b0d4d4673b9e6448cd155617414e
parent165f783235a028d969ac7de0b509647ad3157b19
rtmp: fix multiple broken overflow checks

Sanity checks like `data + size >= data_end || data + size < data' are
broken, because `data + size < data' assumes pointer overflow, which is
undefined behavior in C.  Many compilers such as gcc/clang optimize such
checks away.

Use `size < 0 || size >= data_end - data' instead.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 902cfe2f74d777a7dc20ac68f2393b9f84b790c1)

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