Re: wrong check condition in patch-delta.c?
- From
- Marco Roeland <marco.roeland@xs4all.nl>
- Date
- Jun 20, 2006, 07:21 UTC
- Message-ID
- <20060620072150.GB26656@fiberbit.xs4all.nl>
- In-Reply-To
- <fcaeb9bf0606192332j5b2ee4b9ycf2c63c7b1820204@mail.gmail.com>
On Tuesday June 20th 2006 Nguy???n Thái Ng???c Duy wrote:
Show 6 quoted lines
> While inspecting patch-delta.c, I encounter this: > if (cp_off + cp_size < cp_size || > cp_off + cp_size > src_size || > cp_size > size) > goto bad; > "cp_off + cp_size < cp_size" doesn't make sense to me. Is it on purpose?
It protects against possible overflow. Adding fixed length integers is "wraparound" after all and discards the "carry" bit.
-- Marco Roeland