[RFC PATCH 0/2] reftable: remove poor man's SANITIZE=address, fix a memset() bug
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Apr 15, 2022, 10:21 UTC
- Message-ID
- <RFC-cover-0.2-00000000000-20220415T101740Z-avarab@gmail.com>
- In-Reply-To
- <20220415083058.29495-1-carenas@gmail.com>
On Fri, Apr 15 2022, Carlo Marcelo Arenas Belón wrote:
Show 6 quoted lines
> 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.
FWIW I've been carrying 1/2 here for a while in my local tree, i.e. reftable/* has various abstractions and indirections that aren't really needed. In this case we can just get rid of that & free them, so the memset()s you fixed can just be removed.
The 2/2 is then another memset() issue I spotted when looking at this again, -fanalyzer notes the bug related to it.
Ævar Arnfjörð Bjarmason (2): reftable: remove the "return_block" abstraction reftable: don't memset() a NULL from failed malloc()
reftable/block.c | 4 +--- reftable/blocksource.c | 28 +--------------------------- reftable/publicbasics.c | 2 ++ reftable/reftable-blocksource.h | 2 -- 4 files changed, 4 insertions(+), 32 deletions(-)
-- 2.36.0.rc2.863.gfc2c14e3b91