fix #369
authorYann Collet <cyan@fb.com>
Mon, 26 Jun 2017 18:29:05 +0000 (11:29 -0700)
committerYann Collet <cyan@fb.com>
Mon, 26 Jun 2017 18:29:05 +0000 (11:29 -0700)
commit6ad3a983dbf3a25273e04051d29022c72c469cd5
treec010e4eb8b3811a97d7c23552bdfc957bd30bcb0
parent2ef4afeebeadae41a83f4cb5702180f8137c30f6
fix #369

The bug would make the bt search read one byte in an invalid memory region,
and make a branch decision based on its value.
Impact was small (missed compression opportunity).
It only happens in -BD mode, with extDict-prefix overlapping matches.

The bt match search is supposed to work also in extDict mode.
In which case, the match ptr can point into Dict.
When the match was overlapping Dict<->Prefix,
match[matchLength] would end up outside of Dict, in an invalid memory area.
The correction ensures that in such a case,
match[matchLength] ends up at intended location, inside prefix.
lib/lz4.c
lib/lz4opt.h