Revision b1c2f57db326c43ec286855b396fb16b4890cf2d authored by Jeff King on 28 October 2012, 11:40:00 UTC, committed by Jeff King on 28 October 2012, 11:59:44 UTC
If you use "-G" to grep a diff, we will apply a configured
textconv filter to the data before generating the diff.
However, if the diff is an addition or deletion, we do not
bother running the diff at all, and just look for the token
in the added (or removed) content. This works because we
know that the diff must contain every line of content.

However, while we used the textconv-derived buffers in the
regular diff, we accidentally passed the original unmodified
buffers to regexec when checking the added or removed
content. This could lead to an incorrect answer.

Worse, in some cases we might have a textconv buffer but no
original buffer (e.g., if we pulled the textconv data from
cache, or if we reused a working tree file when generating
it). In that case, we could actually feed NULL to regexec
and segfault.

Reported-by: Peter Oberndorfer <kumbayo84@arcor.de>
Signed-off-by: Jeff King <peff@peff.net>
1 parent 7e20105
History
File Mode Size
sha1.c -rw-r--r-- 1.4 KB
sha1.h -rw-r--r-- 559 bytes
sha1ppc.S -rw-r--r-- 7.3 KB

back to top