Remove two redundant validity checks from the LZMA decoder.
These are already checked elsewhere, so omitting these gives (very) tiny speed up.
This commit is contained in:
parent
de74858062
commit
c0e19e0662
|
@ -541,22 +541,12 @@ decode_real(lzma_coder *restrict coder, const uint8_t *restrict in,
|
||||||
if_bit_0(coder->is_rep0_long[state][pos_state]) {
|
if_bit_0(coder->is_rep0_long[state][pos_state]) {
|
||||||
update_bit_0(coder->is_rep0_long[state][pos_state]);
|
update_bit_0(coder->is_rep0_long[state][pos_state]);
|
||||||
|
|
||||||
// Repeating exactly one byte. For
|
|
||||||
// simplicity, it is done here inline
|
|
||||||
// instead of at the end of the main
|
|
||||||
// loop.
|
|
||||||
|
|
||||||
update_short_rep(state);
|
update_short_rep(state);
|
||||||
|
|
||||||
// Security/sanity checks. See the end
|
// Repeat exactly one byte and start a new decoding loop.
|
||||||
// of the main loop for explanation
|
// Note that rep0 is known to have a safe value, thus we
|
||||||
// of these.
|
// don't need to check if we are wrapping the dictionary
|
||||||
if ((rep0 >= coder->lz.pos && !coder->lz.is_full)
|
// when it isn't full yet.
|
||||||
|| in_pos_local > in_size)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Repeat one byte and start a new
|
|
||||||
// decoding loop.
|
|
||||||
coder->lz.dict[coder->lz.pos]
|
coder->lz.dict[coder->lz.pos]
|
||||||
= lz_get_byte(coder->lz, rep0);
|
= lz_get_byte(coder->lz, rep0);
|
||||||
++coder->lz.pos;
|
++coder->lz.pos;
|
||||||
|
@ -622,11 +612,6 @@ decode_real(lzma_coder *restrict coder, const uint8_t *restrict in,
|
||||||
now_pos += len;
|
now_pos += len;
|
||||||
has_produced_output = true;
|
has_produced_output = true;
|
||||||
|
|
||||||
// Validate the buffer position to avoid buffer overflows
|
|
||||||
// on corrupted input data.
|
|
||||||
if (in_pos_local > in_size)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Repeat len bytes from distance of rep0.
|
// Repeat len bytes from distance of rep0.
|
||||||
if (!lzma_lz_out_repeat(&coder->lz, rep0, len))
|
if (!lzma_lz_out_repeat(&coder->lz, rep0, len))
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue