diff options
| author | Carlo Marcelo Arenas Belón <carenas@gmail.com> | 2022-04-15 01:30:59 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-04-15 09:24:02 -0700 |
| commit | e6b2582da30b599d95f40510777c643b9fba9012 (patch) | |
| tree | d6c6395277a540480ccff563ae0703f864ff92cd /commit-graph.c | |
| parent | Git 2.35.3 (diff) | |
| download | git-e6b2582da30b599d95f40510777c643b9fba9012.tar.gz git-e6b2582da30b599d95f40510777c643b9fba9012.zip | |
reftable: avoid undefined behaviour breaking t0032
1214aa841bc (reftable: add blocksource, an abstraction for random
access reads, 2021-10-07), makes the assumption that it is ok to
free a reftable_block pointing to NULL if the size is also set to
0, but implements that using a memset call that at least in glibc
based system will trigger a runtime exception if called with a
NULL pointer as its first parameter.
Avoid doing so by adding a conditional to check for the size in all
three identically looking functions that were affected, and therefore,
still allow memset to help catch callers that might incorrectly pass
a NULL pointer with a non zero size, but avoiding the exception for
the valid cases.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions
