Files
git/builtin
Johannes Schindelin 6876631751 difftool: fix use-after-free
The left and right base directories were pointed to the buf field of
two strbufs, which were subject to change.

A contrived test case shows the problem where a file with a long enough
name to force the strbuf to grow is up-to-date (hence the code path is
used where the work tree's version of the file is reused), and then a
file that is not up-to-date needs to be written (hence the code path is
used where checkout_entry() uses the previously recorded base_dir that
is invalid by now).

Let's just copy the base_dir strings for use with checkout_entry(),
never touch them until the end, and release them then. This is an easily
verifiable fix (as opposed to the next-obvious alternative: to re-set
base_dir after every loop iteration).

This fixes https://github.com/git-for-windows/git/issues/1124

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-04-26 17:45:31 +02:00
..
2016-12-21 14:55:01 -08:00
2016-11-22 13:55:20 -08:00
2017-04-26 16:57:58 +02:00
2016-09-29 15:42:18 -07:00
2017-01-30 14:17:00 -08:00
2017-01-30 14:17:00 -08:00
2017-04-26 17:45:31 +02:00
2017-04-26 16:58:01 +02:00
2016-09-26 16:09:17 -07:00
2016-11-22 13:13:16 -08:00
2016-09-29 15:42:18 -07:00
2017-01-18 15:12:15 -08:00
2016-09-29 15:42:18 -07:00
2017-01-31 13:14:56 -08:00
2017-04-26 16:58:01 +02:00
2017-01-23 18:51:56 -08:00
2017-01-31 13:14:58 -08:00