<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.c, branch v2.10.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.10.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.10.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-09-29T23:49:35Z</updated>
<entry>
<title>Merge branch 'rs/strbuf-remove-fix' into maint</title>
<updated>2016-09-29T23:49:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-09-29T23:49:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b0af4819938761654050d934c12c244c2de629be'/>
<id>urn:sha1:b0af4819938761654050d934c12c244c2de629be</id>
<content type='text'>
Code cleanup.

* rs/strbuf-remove-fix:
  strbuf: use valid pointer in strbuf_remove()
</content>
</entry>
<entry>
<title>strbuf: use valid pointer in strbuf_remove()</title>
<updated>2016-09-13T23:07:37Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-09-13T16:40:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a8342a417e48385f7ebc19ab46a940ea1fa060ae'/>
<id>urn:sha1:a8342a417e48385f7ebc19ab46a940ea1fa060ae</id>
<content type='text'>
The fourth argument of strbuf_splice() is passed to memcpy(3), which is
not supposed to handle NULL pointers.  Let's be extra careful and use a
valid empty string instead.  It even shortens the source code. :)

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/use-strbuf-addbuf' into maint</title>
<updated>2016-08-08T21:21:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-08-08T21:21:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48aa37ed4266e75340abd3232860d6d14a30c774'/>
<id>urn:sha1:48aa37ed4266e75340abd3232860d6d14a30c774</id>
<content type='text'>
Code cleanup.

* rs/use-strbuf-addbuf:
  strbuf: avoid calling strbuf_grow() twice in strbuf_addbuf()
  use strbuf_addbuf() for appending a strbuf to another
</content>
</entry>
<entry>
<title>strbuf: avoid calling strbuf_grow() twice in strbuf_addbuf()</title>
<updated>2016-07-22T16:22:26Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-07-21T16:46:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=31471ba21ee29886ab856981e52f723c913d7f40'/>
<id>urn:sha1:31471ba21ee29886ab856981e52f723c913d7f40</id>
<content type='text'>
Implement strbuf_addbuf() as a normal function in order to avoid calling
strbuf_grow() twice, with the second callinside strbud_add() being a
no-op.  This is slightly faster and also reduces the text size a bit.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/getwholeline-getdelim-empty' into maint</title>
<updated>2016-04-15T01:57:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-04-15T01:57:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f55f97cb3307f49e6b15d9f0145b6d3f00b22ff7'/>
<id>urn:sha1:f55f97cb3307f49e6b15d9f0145b6d3f00b22ff7</id>
<content type='text'>
strbuf_getwholeline() did not NUL-terminate the buffer on certain
corner cases in its error codepath.

* jk/getwholeline-getdelim-empty:
  strbuf_getwholeline: NUL-terminate getdelim buffer on error
</content>
</entry>
<entry>
<title>Merge branch 'sb/submodule-parallel-update'</title>
<updated>2016-04-06T18:39:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-04-06T18:39:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bdebbeb3346e9867005947aff356b99a7358e5ab'/>
<id>urn:sha1:bdebbeb3346e9867005947aff356b99a7358e5ab</id>
<content type='text'>
A major part of "git submodule update" has been ported to C to take
advantage of the recently added framework to run download tasks in
parallel.

* sb/submodule-parallel-update:
  clone: allow an explicit argument for parallel submodule clones
  submodule update: expose parallelism to the user
  submodule helper: remove double 'fatal: ' prefix
  git submodule update: have a dedicated helper for cloning
  run_processes_parallel: rename parameters for the callbacks
  run_processes_parallel: treat output of children as byte array
  submodule update: direct error message to stderr
  fetching submodules: respect `submodule.fetchJobs` config option
  submodule-config: drop check against NULL
  submodule-config: keep update strategy around
</content>
</entry>
<entry>
<title>Merge branch 'jk/getwholeline-getdelim-empty'</title>
<updated>2016-04-03T17:29:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-04-03T17:29:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=087f171f1401f15672821d8a661ad736a3b296f3'/>
<id>urn:sha1:087f171f1401f15672821d8a661ad736a3b296f3</id>
<content type='text'>
strbuf_getwholeline() did not NUL-terminate the buffer on certain
corner cases in its error codepath.

* jk/getwholeline-getdelim-empty:
  strbuf_getwholeline: NUL-terminate getdelim buffer on error
</content>
</entry>
<entry>
<title>strbuf_getwholeline: NUL-terminate getdelim buffer on error</title>
<updated>2016-03-05T18:57:37Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-03-05T18:43:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b70904306fc30857fa3638d2bce7ae0ad1251e23'/>
<id>urn:sha1:b70904306fc30857fa3638d2bce7ae0ad1251e23</id>
<content type='text'>
Commit 0cc30e0 (strbuf_getwholeline: use getdelim if it is
available, 2015-04-16) tries to clean up after getdelim()
returns EOF, but gets one case wrong, which can lead in some
obscure cases to us reading uninitialized memory.

After getdelim() returns -1, we re-initialize the strbuf
only if sb-&gt;buf is NULL. The thinking was that either:

  1. We fed an existing allocated buffer to getdelim(), and
     at most it would have realloc'd, leaving our NUL in
     place.

  2. We didn't have a buffer to feed, so we gave getdelim()
     NULL; sb-&gt;buf will remain NULL, and we just want to
     restore the empty slopbuf.

But that second case isn't quite right. getdelim() may
allocate a buffer, write nothing into it, and then return
EOF. The resulting strbuf rightfully has sb-&gt;len set to "0",
but is missing the NUL terminator in the first byte.

Most call-sites are fine with this. They see the EOF and
don't bother looking at the strbuf. Or they notice that
sb-&gt;len is empty, and don't look at the contents. But
there's at least one case that does neither, and relies on
parsing the resulting (possibly zero-length) string:
fast-import. You can see this in action with the new test
(though we probably only notice failure there when run with
--valgrind or ASAN).

We can fix this by unconditionally resetting the strbuf when
we have a buffer after getdelim(). That fixes case 2 above.
Case 1 is probably already fine in practice, but it does not
hurt for us to re-assert our invariants (especially because
we are relying on whatever getdelim() happens to do, which
may vary from platform to platform). Our fix covers that
case, too.

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>run_processes_parallel: treat output of children as byte array</title>
<updated>2016-03-01T19:57:19Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2016-03-01T02:07:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2dac9b5637abe580e8b8ea36e00dbbf28ec99af6'/>
<id>urn:sha1:2dac9b5637abe580e8b8ea36e00dbbf28ec99af6</id>
<content type='text'>
We do not want the output to be interrupted by a NUL byte, so we
cannot use raw fputs. Introduce strbuf_write to avoid having long
arguments in run-command.c.

Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/tighten-alloc'</title>
<updated>2016-02-26T21:37:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-26T21:37:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=11529ecec914d2f0d7575e6d443c2d5a6ff75424'/>
<id>urn:sha1:11529ecec914d2f0d7575e6d443c2d5a6ff75424</id>
<content type='text'>
Update various codepaths to avoid manually-counted malloc().

* jk/tighten-alloc: (22 commits)
  ewah: convert to REALLOC_ARRAY, etc
  convert ewah/bitmap code to use xmalloc
  diff_populate_gitlink: use a strbuf
  transport_anonymize_url: use xstrfmt
  git-compat-util: drop mempcpy compat code
  sequencer: simplify memory allocation of get_message
  test-path-utils: fix normalize_path_copy output buffer size
  fetch-pack: simplify add_sought_entry
  fast-import: simplify allocation in start_packfile
  write_untracked_extension: use FLEX_ALLOC helper
  prepare_{git,shell}_cmd: use argv_array
  use st_add and st_mult for allocation size computation
  convert trivial cases to FLEX_ARRAY macros
  use xmallocz to avoid size arithmetic
  convert trivial cases to ALLOC_ARRAY
  convert manual allocations to argv_array
  argv-array: add detach function
  add helpers for allocating flex-array structs
  harden REALLOC_ARRAY and xcalloc against size_t overflow
  tree-diff: catch integer overflow in combine_diff_path allocation
  ...
</content>
</entry>
</feed>
