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

Re: [PATCH] color: protect against out-of-bounds array access/assignment

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 2, 2018, 17:36 UTC
Message-ID
<xmqqftzw3c21.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.1808021438460.71@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 14 quoted lines
> Hi Eric,
>
> On Thu, 2 Aug 2018, Eric Sunshine wrote:
>
>> want_color_fd() is designed to work only with standard input, output,
>> and error file descriptors, and stores information about each descriptor
>> in an array. However, it doesn't verify that the passed-in descriptor
>> lives within that set, which, with a buggy caller, could lead to
>> access/assignment outside the array bounds.
>
> ACK!
>
> Thanks,
> Dscho

Did you write a buggy caller that would have been caught or helped with this change? You did not write the callee that is made more defensive with this patch, so I am being curious as to where that Ack is coming from (I wouldn't have felt curious if this were a reviewed-by instead).

In any case, this looks like a good defensive measure.
Previous: Johannes SchindelinNext: Eric Sunshine
Message 3 of 8 in “color: protect against out-of-bounds array access/assignment”
  1. color: protect against out-of-bounds array access/assignmentEric Sunshine, Aug 2, 2018
  2. Johannes SchindelinAug 2, 2018
  3. Junio C HamanoAug 2, 2018
  4. Eric SunshineAug 2, 2018
  5. Junio C HamanoAug 2, 2018
  6. Jeff KingAug 2, 2018
  7. Jonathan NiederAug 3, 2018
  8. Eric SunshineAug 3, 2018

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.