rtpenc: fix overflow checking in avc_mp4_find_startcode()
authorXi Wang <xi.wang@gmail.com>
Wed, 23 Jan 2013 01:58:07 +0000 (20:58 -0500)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Feb 2013 14:18:23 +0000 (15:18 +0100)
commit165f783235a028d969ac7de0b509647ad3157b19
treeb8820e376c260986b78349243f3753646461148c
parent7a21b089c2751f874aacec0bd16044e5d8facaa3
rtpenc: fix overflow checking in avc_mp4_find_startcode()

The check `start + res < start' is broken since pointer overflow is
undefined behavior in C.  Many compilers such as gcc/clang optimize
away this check.

Use `res > end - start' instead.  Also change `res' to unsigned int
to avoid signed left-shift overflow.

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

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