<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/xdiff, branch v2.26.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.26.1</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.26.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-12-16T21:08:32Z</updated>
<entry>
<title>Merge branch 'rs/xdiff-ignore-ws-w-func-context'</title>
<updated>2019-12-16T21:08:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-16T21:08:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f0070a7df98540ebd0ba6ecb7aef4620efe27724'/>
<id>urn:sha1:f0070a7df98540ebd0ba6ecb7aef4620efe27724</id>
<content type='text'>
The "diff" machinery learned not to lose added/removed blank lines
in the context when --ignore-blank-lines and --function-context are
used at the same time.

* rs/xdiff-ignore-ws-w-func-context:
  xdiff: unignore changes in function context
</content>
</entry>
<entry>
<title>xdiff: unignore changes in function context</title>
<updated>2019-12-05T17:30:06Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2019-12-05T16:15:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0bb313a5529390276cf5c415891c804dea44fa34'/>
<id>urn:sha1:0bb313a5529390276cf5c415891c804dea44fa34</id>
<content type='text'>
Changes involving only blank lines are hidden with --ignore-blank-lines,
unless they appear in the context lines of other changes.  This is
handled by xdl_get_hunk() for context added by --inter-hunk-context, -u
and -U.

Function context for -W and --function-context added by xdl_emit_diff()
doesn't pay attention to such ignored changes; it relies fully on
xdl_get_hunk() and shows just the post-image of ignored changes
appearing in function context.  That's inconsistent and confusing.

Improve the result of using --ignore-blank-lines and --function-context
together by fully showing ignored changes if they happen to fall within
function context.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiffi: fix typos and touch up comments</title>
<updated>2019-10-09T01:58:34Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-10-08T18:27:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=03d3b1297cd2c4db5aec9a977ddf6a13dd9a64de'/>
<id>urn:sha1:03d3b1297cd2c4db5aec9a977ddf6a13dd9a64de</id>
<content type='text'>
Inspired by the thoroughly stale https://github.com/git/git/pull/159,
this patch fixes a couple of typos, rewraps and clarifies some comments.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<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>
</feed>
