aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/lcldec.c
diff options
context:
space:
mode:
authorReimar Döffinger2009-05-31 10:23:38 +0000
committerReimar Döffinger2009-05-31 10:23:38 +0000
commitdbc53ffc7c398f90ae1cf59e513d3882bc0dc188 (patch)
treefe64a0878e7fd1993bfa8867aa4f4cedf9554b4a /libavcodec/lcldec.c
parent2fddb91e9496eb0e3caf99342123ef4cce801c14 (diff)
Change buffer size checks to avoid the undefined overflow case.
Originally committed as revision 19047 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r--libavcodec/lcldec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 4a5a2eb799..9ad731e56a 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -87,7 +87,7 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
continue;
}
if ((mask & (1 << (--maskbit))) == 0) {
- if (destptr + 4 > destptr_end)
+ if (destptr_end - destptr < 4)
break;
memcpy(destptr, srcptr, 4);
srclen -= 4;
@@ -101,7 +101,7 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
ofs &= 0x7ff;
srclen -= 2;
cnt *= 4;
- if (destptr + cnt > destptr_end) {
+ if (destptr_end - destptr < cnt) {
cnt = destptr_end - destptr;
}
for (; cnt > 0; cnt--) {