<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ref-filter.c, branch v2.33.6</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.33.6</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.33.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-08-04T20:28:52Z</updated>
<entry>
<title>Merge branch 'ah/plugleaks'</title>
<updated>2021-08-04T20:28:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-04T20:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=31f9acf9ce29ae210b54997f7fb388a2dc543d53'/>
<id>urn:sha1:31f9acf9ce29ae210b54997f7fb388a2dc543d53</id>
<content type='text'>
Leak plugging.

* ah/plugleaks:
  reset: clear_unpack_trees_porcelain to plug leak
  builtin/rebase: fix options.strategy memory lifecycle
  builtin/merge: free found_ref when done
  builtin/mv: free or UNLEAK multiple pointers at end of cmd_mv
  convert: release strbuf to avoid leak
  read-cache: call diff_setup_done to avoid leak
  ref-filter: also free head for ATOM_HEAD to avoid leak
  diffcore-rename: move old_dir/new_dir definition to plug leak
  builtin/for-each-repo: remove unnecessary argv copy to plug leak
  builtin/submodule--helper: release unused strbuf to avoid leak
  environment: move strbuf into block to plug leak
  fmt-merge-msg: free newly allocated temporary strings when done
</content>
</entry>
<entry>
<title>ref-filter: also free head for ATOM_HEAD to avoid leak</title>
<updated>2021-07-26T19:19:20Z</updated>
<author>
<name>Andrzej Hunt</name>
<email>ajrhunt@google.com</email>
</author>
<published>2021-07-25T13:08:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d7cf4188e2e85faa00552b8616db31a17844df1b'/>
<id>urn:sha1:d7cf4188e2e85faa00552b8616db31a17844df1b</id>
<content type='text'>
u.head is populated using resolve_refdup(), which returns a newly
allocated string - hence we also need to free() it.

Found while running t0041 with LSAN:

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x486804 in strdup ../projects/compiler-rt/lib/asan/asan_interceptors.cpp:452:3
    #1 0xa8be98 in xstrdup wrapper.c:29:14
    #2 0x9481db in head_atom_parser ref-filter.c:549:17
    #3 0x9408c7 in parse_ref_filter_atom ref-filter.c:703:30
    #4 0x9400e3 in verify_ref_format ref-filter.c:974:8
    #5 0x4f9e8b in print_ref_list builtin/branch.c:439:6
    #6 0x4f9e8b in cmd_branch builtin/branch.c:757:3
    #7 0x4ce83e in run_builtin git.c:475:11
    #8 0x4ccafe in handle_builtin git.c:729:3
    #9 0x4cb01c in run_argv git.c:818:4
    #10 0x4cb01c in cmd_main git.c:949:19
    #11 0x6bdc2d in main common-main.c:52:11
    #12 0x7f96edf86349 in __libc_start_main (/lib64/libc.so.6+0x24349)

SUMMARY: AddressSanitizer: 16 byte(s) leaked in 1 allocation(s).

Signed-off-by: Andrzej Hunt &lt;andrzej@ahunt.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>*.c static functions: add missing __attribute__((format))</title>
<updated>2021-07-13T22:20:20Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-07-13T08:05:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48ca53cac4a5bee2dee3a5f3d6550753bf696d28'/>
<id>urn:sha1:48ca53cac4a5bee2dee3a5f3d6550753bf696d28</id>
<content type='text'>
Add missing __attribute__((format)) function attributes to various
"static" functions that take printf arguments.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ref-filter: introduce enum atom_type</title>
<updated>2021-05-13T21:37:28Z</updated>
<author>
<name>ZheNing Hu</name>
<email>adlternative@gmail.com</email>
</author>
<published>2021-05-13T15:15:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1197f1a46360d3ae96bd9c15908a3a6f8e562207'/>
<id>urn:sha1:1197f1a46360d3ae96bd9c15908a3a6f8e562207</id>
<content type='text'>
In the original ref-filter design, it will copy the parsed
atom's name and attributes to `used_atom[i].name` in the
atom's parsing step, and use it again for string matching
in the later specific ref attributes filling step. It use
a lot of string matching to determine which atom we need.

Introduce the enum "atom_type", each enum value is named
as `ATOM_*`, which is the index of each corresponding
valid_atom entry. In the first step of the atom parsing,
`used_atom.atom_type` will record corresponding enum value
from valid_atom entry index, and then in specific reference
attribute filling step, only need to compare the value of
the `used_atom[i].atom_type` to check the atom type.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Signed-off-by: ZheNing Hu &lt;adlternative@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ref-filter: add objectsize to used_atom</title>
<updated>2021-05-13T21:37:27Z</updated>
<author>
<name>ZheNing Hu</name>
<email>adlternative@gmail.com</email>
</author>
<published>2021-05-13T15:15:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0caf20f22806dfd478ab3ac26b5f3682f383d3b4'/>
<id>urn:sha1:0caf20f22806dfd478ab3ac26b5f3682f383d3b4</id>
<content type='text'>
When the support for "objectsize:disk" was bolted onto the
existing support for "objectsize", it didn't follow the
usual pattern for handling "atomtype:modifier", which reads
the &lt;modifier&gt; part just once while parsing the format
string, and store the parsed result in the union in the
used_atom structure, so that the string form of it does not
have to be parsed over and over at runtime (e.g. in
grab_common_values()).

Add a new member `objectsize` to the union `used_atom.u`,
so that we can separate the check of &lt;modifier&gt; from the
check of &lt;atomtype&gt;, this will bring scalability to atom
`%(objectsize)`.

Signed-off-by: ZheNing Hu &lt;adlternative@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ref-filter: get rid of show_ref_array_item</title>
<updated>2021-04-19T22:08:00Z</updated>
<author>
<name>ZheNing Hu</name>
<email>adlternative@gmail.com</email>
</author>
<published>2021-04-19T11:28:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=22f69a85edf29dba2278b55f14419e4ea48148d2'/>
<id>urn:sha1:22f69a85edf29dba2278b55f14419e4ea48148d2</id>
<content type='text'>
Inlining the exported function `show_ref_array_item()`,
which is not providing the right level of abstraction,
simplifies the API and can unlock improvements at the
former call sites.

Helped-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: ZheNing Hu &lt;adlternative@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/ref-filter-segfault-fix'</title>
<updated>2021-04-13T22:28:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-04-13T22:28:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f63add4aa8e8c2ea413fe2bf3b5c9b0f55617e8b'/>
<id>urn:sha1:f63add4aa8e8c2ea413fe2bf3b5c9b0f55617e8b</id>
<content type='text'>
A NULL-dereference bug has been corrected in an error codepath in
"git for-each-ref", "git branch --list" etc.

* jk/ref-filter-segfault-fix:
  ref-filter: fix NULL check for parse object failure
</content>
</entry>
<entry>
<title>ref-filter: fix NULL check for parse object failure</title>
<updated>2021-04-01T19:54:21Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-04-01T08:32:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c6854508808dd32e3fc20c5b021c4064d25f6438'/>
<id>urn:sha1:c6854508808dd32e3fc20c5b021c4064d25f6438</id>
<content type='text'>
After we run parse_object_buffer() to get an object's contents, we try
to check that the return value wasn't NULL. However, since our "struct
object" is a pointer-to-pointer, and we assign like:

  *obj = parse_object_buffer(...);

it's not correct to check:

  if (!obj)

That will always be true, since our double pointer will continue to
point to the single pointer (which is itself NULL). This is a regression
that was introduced by aa46a0da30 (ref-filter: use oid_object_info() to
get object, 2018-07-17); since that commit we'll segfault on a parse
failure, as we try to look at the NULL object pointer.

There are many ways a parse could fail, but most of them are hard to set
up in the tests (it's easy to make a bogus object, but update-ref will
refuse to point to it). The test here uses a tag which points to a wrong
object type. A parse of just the broken tag object will succeed, but
seeing both tag objects in the same process will lead to a parse error
(since we'll see the pointed-to object as both types).

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 'rs/xcalloc-takes-nelem-first'</title>
<updated>2021-03-19T22:25:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-03-19T22:25:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bfcc6e2a68b95ee71fc606a2e3917af78f1130f9'/>
<id>urn:sha1:bfcc6e2a68b95ee71fc606a2e3917af78f1130f9</id>
<content type='text'>
Code cleanup.

* rs/xcalloc-takes-nelem-first:
  fix xcalloc() argument order
</content>
</entry>
<entry>
<title>use CALLOC_ARRAY</title>
<updated>2021-03-14T00:00:09Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2021-03-13T16:17:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ca56dadb4b65ccaeab809d80db80a312dc00941a'/>
<id>urn:sha1:ca56dadb4b65ccaeab809d80db80a312dc00941a</id>
<content type='text'>
Add and apply a semantic patch for converting code that open-codes
CALLOC_ARRAY to use it instead.  It shortens the code and infers the
element size automatically.

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>
</feed>
