[Bug analyzer/105285] False positive with -Wanalyzer-null-dereference in git.git's reftable/reader.c

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 27 18:08:52 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105285

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
For (b), I'm not convinced git's code is totally correct here.

The early-reject case in reader_get_block returns 0:

  if (off >= r->size)
    return 0;

but at the caller, the condition is < 0:

  err = reader_get_block(r, &block, next_off, guess_block_size);
  if (err < 0)
    goto done;

so if the early reject does happen, the returned "err" will be zero, not
less-than-zero.

Is that a problem?


More information about the Gcc-bugs mailing list