Re: [PATCH] strbuf: stop out-of-boundary warnings from Coverity
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 17, 2015, 20:03 UTC
- Message-ID
- <CAGZ79kZCGck24KZBhVa9TGtR4U6Moz-vHNrBMk0HLTz6YeHhsg@mail.gmail.com>
- In-Reply-To
- <20150617191235.GB25304@peff.net>
On Wed, Jun 17, 2015 at 12:12 PM, Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
> On Wed, Jun 17, 2015 at 10:58:10AM -0700, Stefan Beller wrote: > >> > Just make strbuf_slopbuf[] large enough to keep Coverity happy. If it's >> > happy, we'll have cleaner defect list >> >> It's down 31 defects, roughly 10% of all things coverity detected as >> problematic. >> YAY! > > That's a good thing. I do find the solution a little gross, though. I > wonder if there is a way we can tell coverity more about how strbuf > works.
I always thought the problem was a combination of both having a custom strcmp (like skip_prefix, starts_with) and a custom data structure (strbuf, string_list). So I am not sure if it is sufficient to tell coverity
Show 6 quoted lines
> I've noticed similar problems with string_list, where it > complains that we are touching list->items, which was assigned to NULL > (of course it was, but then after that we did string_list_append!). > > I know literally nothing about coverity's annotations and what's > possible with them. So I may be barking up a wrong tree completely.
I have searched for the exact annotations for a while, but all I found were examples in other open source projects, no official documentation with all its features. I may be missing something though (there must be some official documentation, I'd assume).
> > -Peff