git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: wrong check condition in patch-delta.c?

From
MRMarco 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
Previous: Nguyễn Thái Ngọc DuyNext: Nicolas Pitre
Message 2 of 3 in “wrong check condition in patch-delta.c?”
  1. Nguyễn Thái Ngọc DuyJun 20, 2006
  2. Marco RoelandJun 20, 2006
  3. Nicolas PitreJun 20, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.