From: Junio C Hamano Date: Mon, 21 Sep 2026 21:24:28 GMT Subject: Re: [PATCH 3/6] wrapper: create safe_memory_limit_check() Message-ID: In-Reply-To: <3b3c67243d200a42aa105981b64228e2cbb35a6c.1789736540.git.gitgitgadget@gmail.com> "Derrick Stolee via GitGitGadget" writes: > +static int safe_memory_limit_check(size_t size, int verbose) > { > + size_t limit = git_alloc_limit ? git_alloc_limit : SIZE_MAX; > + if (size > limit) { > + if (verbose) > error("attempting to allocate %"PRIuMAX" over limit %"PRIuMAX, > (uintmax_t)size, (uintmax_t)git_alloc_limit); > + return -1; > } > return 0; > } The code is prepared for a case where git_alloc_limit is set to 0, in which case SIZE_MAX is used as a stand-in value. When the check detects a request with overly large 'size', the error message tells us that 'size' is over 'git_alloc_limit', the latter is zero and any concrete value of 'size' certainly would be over that. Which may be a bit confusing. Shouldn't we be giving the local "limit" instead in the message?