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

Re: Covierty Integration / Improvement

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 6, 2022, 20:20 UTC
Message-ID
<xmqqfsmqx8ud.fsf@gitster.g>
In-Reply-To
<Yk3UAz3sn9KhMnyf@mit.edu>
"Theodore Ts'o" <tytso@mit.edu> writes:
Show 18 quoted lines
> On Wed, Apr 06, 2022 at 05:08:37PM +0200, Johannes Schindelin wrote:
>> I have fixed Git for Windows' Coverity build and started to sift through
>> the 154 new defects reported as of v2.36.0-rc0.
>> 
>> Sadly, there is now a new class of overwhelming false positives: Coverity
>> claims that "strbuf_addstr does not [NUL-]terminate", which is of course
>> false.
>
> It should be possible to suppress this by uploading a Coverity model
> file.  See[1] for more details:
>
> [1] https://community.synopsys.com/s/article/practical-example-of-coverity-function-model
>
> I've suppressed a similar issue by using the attribute __nonstring,
> but I don't think that will work for git, because strbuf->buf really
> *is* a NUL-terminated string, where as in ext4 we have some fields
> which are designed to be NUL padded, but it is *not* guaranteed to be
> NUL-terminated:

That is very much expected from filesystem code, for which strncmp() and friends were invented for ;-)

Show 5 quoted lines
> (This is needed to suppress warnings by Clang as well.)
>
> Using __nonstring will result in attempts to use s_volume_name in "C"
> string context to give a warning, which is why this isn't right for
> strbuf->buf.

Indeed. We do aim to make reading .buf member as NUL-terminated string safe, so it would make it very inconvenient to warn against such uses.

Thanks.
Previous: Theodore Ts'oNext: Johannes Schindelin
Message 9 of 13 in “Covierty Integration / Improvement”
  1. Markus VervierApr 1, 2022
  2. Junio C HamanoApr 3, 2022
  3. Theodore Ts'oApr 3, 2022
  4. Ævar Arnfjörð BjarmasonApr 4, 2022
  5. Johannes SchindelinApr 5, 2022
  6. Johannes SchindelinApr 5, 2022
  7. Johannes SchindelinApr 6, 2022
  8. Theodore Ts'oApr 6, 2022
  9. Junio C HamanoApr 6, 2022
  10. Johannes SchindelinApr 7, 2022
  11. Markus VervierApr 7, 2022
  12. Johannes SchindelinApr 7, 2022
  13. Derek ZimmerMay 10, 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.