Mercurial > libavcodec.hg
changeset 9763:d359d5ee74b9 libavcodec
Change buffer size checks to avoid the undefined overflow case.
author | reimar |
---|---|
date | Sun, 31 May 2009 10:23:38 +0000 |
parents | 3242ae563430 |
children | dd6bcbec3c24 |
files | lcldec.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lcldec.c Sun May 31 10:16:28 2009 +0000 +++ b/lcldec.c Sun May 31 10:23:38 2009 +0000 @@ -87,7 +87,7 @@ 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 @@ ofs &= 0x7ff; srclen -= 2; cnt *= 4; - if (destptr + cnt > destptr_end) { + if (destptr_end - destptr < cnt) { cnt = destptr_end - destptr; } for (; cnt > 0; cnt--) {