r7777 - trunk/libavcodec/lzo.c
Author: reimar Date: Wed Jan 31 11:29:58 2007 New Revision: 7777 Modified: trunk/libavcodec/lzo.c Log: Add two extra needed bounds checks Modified: trunk/libavcodec/lzo.c ============================================================================== --- trunk/libavcodec/lzo.c (original) +++ trunk/libavcodec/lzo.c Wed Jan 31 11:29:58 2007 @@ -182,6 +182,8 @@ x = GETB(c); if (x < 16) c.error |= LZO_ERROR; } + if (c.in > c.in_end) + c.error |= LZO_INPUT_DEPLETED; while (!c.error) { int cnt, back; if (x > 15) { @@ -209,6 +211,10 @@ cnt = get_len(&c, x, 15); copy(&c, cnt + 3); x = GETB(c); + if (c.in > c.in_end) { + c.error |= LZO_INPUT_DEPLETED; + continue; + } if (x >> 4) continue; cnt = 1;
Hi On Wed, Jan 31, 2007 at 11:29:58AM +0100, reimar wrote:
Author: reimar Date: Wed Jan 31 11:29:58 2007 New Revision: 7777
Modified: trunk/libavcodec/lzo.c
Log: Add two extra needed bounds checks
are they really needed? also we always seem to read one byte after copy() so we could just check that one more is available in copy ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle
Hello, On Wed, Jan 31, 2007 at 11:36:27AM +0100, Michael Niedermayer wrote:
On Wed, Jan 31, 2007 at 11:29:58AM +0100, reimar wrote:
Author: reimar Date: Wed Jan 31 11:29:58 2007 New Revision: 7777
Modified: trunk/libavcodec/lzo.c
Log: Add two extra needed bounds checks
are they really needed?
The one before the continue yes. The one outside the loop should not hurt either way.
also we always seem to read one byte after copy() so we could just check that one more is available in copy ...
Probably. I admit I was trying to move the checks in copy() so that they are only done for blocks > 4 bytes, then those would definitly be needed, but I was not able to get a significant speedup up to now... Greetings, Reimar Doeffinger
participants (3)
-
michaelni@gmx.at -
Reimar.Doeffinger@stud.uni-karlsruhe.de -
subversion@mplayerhq.hu