<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/xdiff, branch v2.23.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.23.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.23.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-07-31T21:38:56Z</updated>
<entry>
<title>Merge branch 'cb/xdiff-no-system-includes-in-dot-c'</title>
<updated>2019-07-31T21:38:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-07-31T21:38:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d163b6ae6b6e670494f8547a29eea3ad1e477e82'/>
<id>urn:sha1:d163b6ae6b6e670494f8547a29eea3ad1e477e82</id>
<content type='text'>
Compilation fix.

* cb/xdiff-no-system-includes-in-dot-c:
  xdiff: remove duplicate headers from xpatience.c
  xdiff: remove duplicate headers from xhistogram.c
  xdiff: drop system includes in xutils.c
</content>
</entry>
<entry>
<title>Merge branch 'jk/xdiff-clamp-funcname-context-index'</title>
<updated>2019-07-29T19:39:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-07-29T19:39:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c3d4c20c7d862fb168b4b2126443e13c55737507'/>
<id>urn:sha1:c3d4c20c7d862fb168b4b2126443e13c55737507</id>
<content type='text'>
The internal diff machinery can be made to read out of bounds while
looking for --funcion-context line in a corner case, which has been
corrected.

* jk/xdiff-clamp-funcname-context-index:
  xdiff: clamp function context indices in post-image
</content>
</entry>
<entry>
<title>xdiff: remove duplicate headers from xpatience.c</title>
<updated>2019-07-29T04:51:22Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2019-07-28T20:07:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=81ed2b405cc6eca56fa4ab8eb1fb3efb839e353c'/>
<id>urn:sha1:81ed2b405cc6eca56fa4ab8eb1fb3efb839e353c</id>
<content type='text'>
92b7de93fb (Implement the patience diff algorithm, 2009-01-07) added them
but were already part of xinclude.h

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: remove duplicate headers from xhistogram.c</title>
<updated>2019-07-29T04:51:21Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2019-07-28T20:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29a0f9038eb050fac4b4d284c4852b82d4d401d3'/>
<id>urn:sha1:29a0f9038eb050fac4b4d284c4852b82d4d401d3</id>
<content type='text'>
8c912eea94 ("teach --histogram to diff", 2011-07-12) included them, but
were already part of xinclude.h

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: drop system includes in xutils.c</title>
<updated>2019-07-29T04:51:19Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2019-07-28T20:07:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0d0e1e85aad517e46bcb341cd7081395de9c6dee'/>
<id>urn:sha1:0d0e1e85aad517e46bcb341cd7081395de9c6dee</id>
<content type='text'>
After b46054b374 ("xdiff: use git-compat-util", 2019-04-11), two system
headers added with 6942efcfa9 ("xdiff: load full words in the inner loop
of xdl_hash_record", 2012-04-06) to xutils.c are no longer needed and
could conflict as shown below from an OpenIndiana build:

In file included from xdiff/xinclude.h:26:0,
                 from xdiff/xutils.c:25:
./git-compat-util.h:4:0: warning: "_FILE_OFFSET_BITS" redefined
 #define _FILE_OFFSET_BITS 64

In file included from /usr/include/limits.h:37:0,
                 from xdiff/xutils.c:23:
/usr/include/sys/feature_tests.h:231:0: note: this is the location of the previous definition
 #define _FILE_OFFSET_BITS 32

Make sure git-compat-util.h is the first header (through xinclude.h)

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: clamp function context indices in post-image</title>
<updated>2019-07-23T21:26:13Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-07-23T19:27:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b777f3fd619ac2af507ffd3e7c5fe0d6e36e81f2'/>
<id>urn:sha1:b777f3fd619ac2af507ffd3e7c5fe0d6e36e81f2</id>
<content type='text'>
After finding a function line for --function-context in the pre-image,
xdl_emit_diff() calculates the equivalent line in the post-image.  It
assumes that the lines between changes are the same on both sides.  If
the option --ignore-blank-lines was also given then this is not
necessarily true.

Clamp the calculation results for start and end of the function context
to prevent out-of-bounds array accesses.

Note that this _just_ fixes the case where our mismatch sends us off the
beginning of the file. There are likely other cases where our assumption
causes us to go to the wrong line within the file. Nobody has developed
a test case yet, and the ultimate fix is likely more complicated than
this patch. But this at least prevents a segfault in the meantime.

Credit for finding the bug goes to "Liu Wei of Tencent Security Xuanwu
Lab".

Reported-by: 刘炜 &lt;lw17qhdz@gmail.com&gt;
Helped-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: use xmalloc/xrealloc</title>
<updated>2019-04-12T04:34:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-04-11T13:49:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=36c831972497c1141a704fb5ad179675111ee321'/>
<id>urn:sha1:36c831972497c1141a704fb5ad179675111ee321</id>
<content type='text'>
Most of xdiff uses a bare malloc() to allocate memory, and returns an
error when we get NULL. However, there are a few spots which don't check
the return value and may segfault, including at least xdl_merge() and
xpatience.c's find_longest_common_sequence().

Let's use xmalloc() everywhere instead, so that we get a graceful die()
for these cases, without having to do further auditing. This does mean
the existing cases which check errors will now die() instead of
returning an error up the stack. But:

  - that's how the rest of Git behaves already for malloc errors

  - all of the callers of xdi_diff(), etc, die upon seeing an error

So while we might one day want to fully lib-ify the diff code and make
it possible to use as part of a long-running process, we're not close to
that now. And because we're just tweaking the xdl_malloc() macro here,
we're not really moving ourselves any further away from that. We
could, for example, simplify some of the functions which handle malloc()
errors which can no longer occur. But that would probably be taking us
in the wrong direction.

This also makes our malloc handling more consistent with the rest of
Git, including enforcing GIT_ALLOC_LIMIT and trying to reclaim pack
memory when needed.

Reported-by: 王健强 &lt;jianqiang.wang@securitygossip.com&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: use git-compat-util</title>
<updated>2019-04-12T04:34:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-04-11T13:48:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b46054b3746271d23feab001b49357983fda42f1'/>
<id>urn:sha1:b46054b3746271d23feab001b49357983fda42f1</id>
<content type='text'>
Since the xdiff library was not originally part of Git, it does its own
system includes. Let's instead use git-compat-util, which has two
benefits:

  1. It adjusts for any system-specific quirks in how or what we should
     include (though xdiff's needs are light enough that this hasn't
     been a problem in the past).

  2. It lets us use wrapper functions like xmalloc().

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: provide a separate emit callback for hunks</title>
<updated>2018-11-02T11:43:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T06:35:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=611e42a5980a3a9f8bb3b1b49c1abde63c7a191e'/>
<id>urn:sha1:611e42a5980a3a9f8bb3b1b49c1abde63c7a191e</id>
<content type='text'>
The xdiff library always emits hunk header lines to our callbacks as
formatted strings like "@@ -a,b +c,d @@\n". This is convenient if we're
going to output a diff, but less so if we actually need to compute using
those numbers, which requires re-parsing the line.

In preparation for moving away from this, let's teach xdiff a new
callback function which gets the broken-out hunk information. To help
callers that don't want to use this new callback, if it's NULL we'll
continue to format the hunk header into a string.

Note that this function renames the "outf" callback to "out_line", as
well. This isn't strictly necessary, but helps in two ways:

  1. Now that there are two callbacks, it's nice to use more descriptive
     names.

  2. Many callers did not zero the emit_callback_data struct, and needed
     to be modified to set ecb.out_hunk to NULL. By changing the name of
     the existing struct member, that guarantees that any new callers
     from in-flight topics will break the build and be examined
     manually.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/indent-heuristic-optim'</title>
<updated>2018-08-17T20:09:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-17T20:09:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=791ad494835ac544d9e91573f3a65aeb97d126ed'/>
<id>urn:sha1:791ad494835ac544d9e91573f3a65aeb97d126ed</id>
<content type='text'>
"git diff --indent-heuristic" had a bad corner case performance.

* sb/indent-heuristic-optim:
  xdiff: reduce indent heuristic overhead
</content>
</entry>
</feed>
