mirror of https://git.tukaani.org/xz.git
In lzma_read_match_distances(), don't use
coder->lz.stream_end_was_reached. That variable will be removed, and the check isn't required anyway. Rearrange the check so that it doesn't make one to think that there could be an integer overflow.
This commit is contained in:
parent
a670fec802
commit
3e09e1c058
|
@ -197,12 +197,12 @@ lzma_read_match_distances(lzma_coder *coder,
|
||||||
uint32_t limit = MATCH_MAX_LEN - *len_res;
|
uint32_t limit = MATCH_MAX_LEN - *len_res;
|
||||||
|
|
||||||
assert(offset + limit < coder->lz.keep_size_after);
|
assert(offset + limit < coder->lz.keep_size_after);
|
||||||
|
assert(coder->lz.read_pos <= coder->lz.write_pos);
|
||||||
|
|
||||||
// If we are close to end of the stream, we may need
|
// If we are close to end of the stream, we may need
|
||||||
// to limit the length of the match.
|
// to limit the length of the match.
|
||||||
if (coder->lz.stream_end_was_reached
|
if (coder->lz.write_pos - coder->lz.read_pos
|
||||||
&& coder->lz.write_pos
|
< offset + limit)
|
||||||
< coder->lz.read_pos + offset + limit)
|
|
||||||
limit = coder->lz.write_pos
|
limit = coder->lz.write_pos
|
||||||
- (coder->lz.read_pos + offset);
|
- (coder->lz.read_pos + offset);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue