diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lzma/LzmaDec.c | 18 | ||||
-rw-r--r-- | lib/zlib/inflate.c | 5 |
2 files changed, 7 insertions, 16 deletions
diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c index 341149f766b..a90b35c6a99 100644 --- a/lib/lzma/LzmaDec.c +++ b/lib/lzma/LzmaDec.c @@ -152,8 +152,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte const Byte *buf = p->buf; UInt32 range = p->range; UInt32 code = p->code; - - schedule(); + unsigned int loop = 0; do { @@ -162,6 +161,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte unsigned ttt; unsigned posState = processedPos & pbMask; + if (!(loop++ & 1023)) + schedule(); + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; IF_BIT_0(prob) { @@ -177,8 +179,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte state -= (state < 4) ? state : 3; symbol = 1; - schedule(); - do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); } else @@ -188,8 +188,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte state -= (state < 10) ? 3 : 6; symbol = 1; - schedule(); - do { unsigned bit; @@ -321,8 +319,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte UInt32 mask = 1; unsigned i = 1; - schedule(); - do { GET_BIT2(prob + i, i, ; , distance |= mask); @@ -335,8 +331,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte { numDirectBits -= kNumAlignBits; - schedule(); - do { NORMALIZE @@ -409,8 +403,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte const Byte *lim = dest + curLen; dicPos += curLen; - schedule(); - do *(dest) = (Byte)*(dest + src); while (++dest != lim); @@ -418,8 +410,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte else { - schedule(); - do { dic[dicPos++] = dic[pos]; diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index 30dfe155995..8f767b7b9d2 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -455,8 +455,9 @@ int ZEXPORT inflate(z_streamp strm, int flush) if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); |