From: Simon Richter Date: Sat, 31 Oct 2026 17:06:09 GMT Subject: Re: [PATCH 0/4] use size_t when parsing and checking objects Message-ID: In-Reply-To: Hi, On 10/31/26 20:09, Elia Pinto wrote: > This series continues the search for truncated sizes on platforms where > "long" is 32 bits (Windows). It covers the functions that parse, verify, > and check whole objects in memory: they take the size as an "unsigned > long", while their callers have a size_t, so above 4GiB the size gets > truncated. Again, reminder that size_t is also 32 bit on 32-bit architectures, because size_t is used for the size of in-memory objects. Anything that is on disk can have a size that only fits into an off_t, which is 64 bit if large file support is enabled, and 32 bit if it is not. If large file support is disabled, opening a file larger than 2 GB is supposed to fail (because you need to pass O_LARGEFILE, which is defined only if large file support is enabled), but there is a chance that an on-disk object got truncated, so that is not guaranteed. So, use size_t only for in-memory data, but if you are reading data from disk piecewise, the total count of data processed needs to be an off_t. Simon