<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-compat-util.h, branch v2.8.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.8.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.8.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-03-21T16:19:27Z</updated>
<entry>
<title>Merge branch 'es/st-add4-gcc-4.2-workaround' into maint</title>
<updated>2016-03-21T16:19:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-03-21T16:19:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2ab5c88642e96b6cba17079d008531f5647d33cf'/>
<id>urn:sha1:2ab5c88642e96b6cba17079d008531f5647d33cf</id>
<content type='text'>
* es/st-add4-gcc-4.2-workaround:
  git-compat-util: st_add4: work around gcc 4.2.x compiler crash
</content>
</entry>
<entry>
<title>git-compat-util: st_add4: work around gcc 4.2.x compiler crash</title>
<updated>2016-03-21T16:18:07Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2016-03-21T04:35:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d616fbf256ef3102669d450ddadd8469fefcf95c'/>
<id>urn:sha1:d616fbf256ef3102669d450ddadd8469fefcf95c</id>
<content type='text'>
Although changes by 5b442c4 (tree-diff: catch integer overflow in
combine_diff_path allocation, 2016-02-19) are perfectly valid, they
unfortunately trigger an internal compiler error in gcc 4.2.x:

    combine-diff.c: In function 'diff_tree_combined':
    combine-diff.c:1391: internal compiler error: Segmentation fault: 11

Experimentation reveals that changing st_add4()'s argument evaluation
order is sufficient to sidestep this problem.

Although st_add3() does not trigger the compiler bug, for style
consistency, change its argument evaluation order to match.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add helpers for detecting size_t overflow</title>
<updated>2016-03-16T17:41:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-19T11:21:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=935de81289cd04b4736c538747c53df123c30d1c'/>
<id>urn:sha1:935de81289cd04b4736c538747c53df123c30d1c</id>
<content type='text'>
Performing computations on size_t variables that we feed to
xmalloc and friends can be dangerous, as an integer overflow
can cause us to allocate a much smaller chunk than we
realized.

We already have unsigned_add_overflows(), but let's add
unsigned_mult_overflows() to that. Furthermore, rather than
have each site manually check and die on overflow, we can
provide some helpers that will:

  - promote the arguments to size_t, so that we know we are
    doing our computation in the same size of integer that
    will ultimately be fed to xmalloc

  - check and die on overflow

  - return the result so that computations can be done in
    the parameter list of xmalloc.

These functions are a lot uglier to use than normal
arithmetic operators (you have to do "st_add(foo, bar)"
instead of "foo + bar"). To at least limit the damage, we
also provide multi-valued versions. So rather than:

  st_add(st_add(a, b), st_add(c, d));

you can write:

  st_add4(a, b, c, d);

This isn't nearly as elegant as a varargs function, but it's
a lot harder to get it wrong. You don't have to remember to
add a sentinel value at the end, and the compiler will
complain if you get the number of arguments wrong. This
patch adds only the numbered variants required to convert
the current code base; we can easily add more later if
needed.

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 'ak/git-strip-extension-from-dashed-command' into maint</title>
<updated>2016-03-10T19:13:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-03-10T19:13:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=08e21c9b5f3996152080ff22d33d9d2866a3dc26'/>
<id>urn:sha1:08e21c9b5f3996152080ff22d33d9d2866a3dc26</id>
<content type='text'>
Code simplification.

* ak/git-strip-extension-from-dashed-command:
  git.c: simplify stripping extension of a file in handle_builtin()
</content>
</entry>
<entry>
<title>git-compat-util: drop mempcpy compat code</title>
<updated>2016-02-22T22:51:09Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:45:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7eb45b5f78e257a682ec825839b4b33e025a9615'/>
<id>urn:sha1:7eb45b5f78e257a682ec825839b4b33e025a9615</id>
<content type='text'>
There are no callers of this left, as the last one was
dropped in the previous patch. And there are not likely to
be new ones, as the function has been around since 2010
without gaining any new callers.

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>add helpers for allocating flex-array structs</title>
<updated>2016-02-22T22:50:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:43:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3689539127f786f32ff04da374d37cc1f72fb918'/>
<id>urn:sha1:3689539127f786f32ff04da374d37cc1f72fb918</id>
<content type='text'>
Allocating a struct with a flex array is pretty simple in
practice: you over-allocate the struct, then copy some data
into the over-allocation. But it can be a slight pain to
make sure you're allocating and copying the right amounts.

This patch adds a few helpers to turn simple cases of
flex-array struct allocation into a one-liner that properly
checks for overflow. See the embedded documentation for
details.

Ideally we could provide a more flexible version that could
handle multiple strings, like:

  FLEX_ALLOC_FMT(ref, name, "%s%s", prefix, name);

But we have to implement this as a macro (because of the
offset calculation of the flex member), which means we would
need all compilers to support variadic macros.

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>harden REALLOC_ARRAY and xcalloc against size_t overflow</title>
<updated>2016-02-22T22:50:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:43:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e7792a74bcf7fcd554b4546fc91122b8c2af7d75'/>
<id>urn:sha1:e7792a74bcf7fcd554b4546fc91122b8c2af7d75</id>
<content type='text'>
REALLOC_ARRAY inherently involves a multiplication which can
overflow size_t, resulting in a much smaller buffer than we
think we've allocated. We can easily harden it by using
st_mult() to check for overflow.  Likewise, we can add
ALLOC_ARRAY to do the same thing for xmalloc calls.

xcalloc() should already be fine, because it takes the two
factors separately, assuming the system calloc actually
checks for overflow. However, before we even hit the system
calloc(), we do our memory_limit_check, which involves a
multiplication. Let's check for overflow ourselves so that
this limit cannot be bypassed.

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>git.c: simplify stripping extension of a file in handle_builtin()</title>
<updated>2016-02-22T07:52:43Z</updated>
<author>
<name>Alexander Kuleshov</name>
<email>kuleshovmail@gmail.com</email>
</author>
<published>2016-02-22T07:18:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=63ca1c099c36e61b0e9cd7fa0b912c0b9d89b628'/>
<id>urn:sha1:63ca1c099c36e61b0e9cd7fa0b912c0b9d89b628</id>
<content type='text'>
The handle_builtin() starts from stripping of command extension if
STRIP_EXTENSION is enabled. Actually STRIP_EXTENSION does not used
anywhere else.

This patch introduces strip_extension() helper to strip STRIP_EXTENSION
extension from argv[0] with the strip_suffix() instead of manually
stripping.

Signed-off-by: Alexander Kuleshov &lt;kuleshovmail@gmail.com&gt;
Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add helpers for detecting size_t overflow</title>
<updated>2016-02-19T17:40:37Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-19T11:21:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=320d0b493a259db3b481f985545b244438e6c086'/>
<id>urn:sha1:320d0b493a259db3b481f985545b244438e6c086</id>
<content type='text'>
Performing computations on size_t variables that we feed to
xmalloc and friends can be dangerous, as an integer overflow
can cause us to allocate a much smaller chunk than we
realized.

We already have unsigned_add_overflows(), but let's add
unsigned_mult_overflows() to that. Furthermore, rather than
have each site manually check and die on overflow, we can
provide some helpers that will:

  - promote the arguments to size_t, so that we know we are
    doing our computation in the same size of integer that
    will ultimately be fed to xmalloc

  - check and die on overflow

  - return the result so that computations can be done in
    the parameter list of xmalloc.

These functions are a lot uglier to use than normal
arithmetic operators (you have to do "st_add(foo, bar)"
instead of "foo + bar"). To at least limit the damage, we
also provide multi-valued versions. So rather than:

  st_add(st_add(a, b), st_add(c, d));

you can write:

  st_add4(a, b, c, d);

This isn't nearly as elegant as a varargs function, but it's
a lot harder to get it wrong. You don't have to remember to
add a sentinel value at the end, and the compiler will
complain if you get the number of arguments wrong. This
patch adds only the numbered variants required to convert
the current code base; we can easily add more later if
needed.

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 'js/dirname-basename' into maint</title>
<updated>2016-02-05T22:54:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-05T22:54:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=07be1da216debe1f76cd4d03ac5effcb9e40e6c6'/>
<id>urn:sha1:07be1da216debe1f76cd4d03ac5effcb9e40e6c6</id>
<content type='text'>
dirname() emulation has been added, as Msys2 lacks it.

* js/dirname-basename:
  mingw: avoid linking to the C library's isalpha()
  t0060: loosen overly strict expectations
  t0060: verify that basename() and dirname() work as expected
  compat/basename.c: provide a dirname() compatibility function
  compat/basename: make basename() conform to POSIX
  Refactor skipping DOS drive prefixes
</content>
</entry>
</feed>
