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

Re: [PATCH] compat/win32: correct for incorrect compiler warning

From
Derrick Stolee <derrickstolee@github.com>
Date
Jul 19, 2022, 20:01 UTC
Message-ID
<8dbcd979-0794-65c9-2192-62d4bfc8ef62@github.com>
In-Reply-To
<CAPig+cSPnQnw82DsDHhMP12sYW_XHUb6+MYt17V=0sWrW4j2iw@mail.gmail.com>
On 7/19/2022 3:48 PM, Eric Sunshine wrote:
Show 16 quoted lines
> On Tue, Jul 19, 2022 at 2:48 PM Derrick Stolee via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> The 'win build' job of our CI build is failing with the following error:
>>
>> compat/win32/syslog.c: In function 'syslog':
>> compat/win32/syslog.c:53:17: error: pointer 'pos' may be used after \
>>                                     'realloc' [-Werror=use-after-free]
>>    53 |                 memmove(pos + 2, pos + 1, strlen(pos));
>>     CC compat/poll/poll.o
>>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> compat/win32/syslog.c:47:23: note: call to 'realloc' here
>>    47 |                 str = realloc(str, st_add(++str_len, 1));
>>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Removing the unrelated "CC compat/poll/poll.o" line would help make
> this output less confusing.
Yes, sorry. It's output from the parallel build that I should have noticed.
 
Show 10 quoted lines
>> However, between this realloc() and the use we have a line that resets
>> the value of 'pos'. Thus, this error is incorrect. It is likely due to a
>> new version of the compiler on the CI machines.
>>
>> Instead of waiting for a new compiler, create a new variable to avoid
>> this error.
> 
> If possible, it is a good idea to mention the actual compiler version
> in the commit message as an aid to future readers who might want to
> know if this sort of workaround is still needed.

I wish I knew. I can only guess that it's a new GCC version on the Windows agents for GitHub Actions, but I don't know exactly which one.

Thanks, -Stolee

Previous: Eric SunshineNext: Junio C Hamano
Message 3 of 5 in “compat/win32: correct for incorrect compiler warning”
  1. compat/win32: correct for incorrect compiler warningDerrick Stolee via GitGitGadget, Jul 19, 2022
  2. Eric SunshineJul 19, 2022
  3. Derrick StoleeJul 19, 2022
  4. Junio C HamanoJul 19, 2022
  5. Phillip WoodJul 21, 2022

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.