Ticket #47994

transfer_city(): NULL could_see_unit[i] for BV_CLR_ALL(could_see_unit[i])

Open Date: 2023-05-08 14:39 Last Update: 2023-05-27 07:36

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
1

Details

Clang analyzer (this particular run on S3_1, but I assume all branches affected):

../../../src/server/citytools.c:1099:5: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
    BV_CLR_ALL(could_see_unit[i]);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/utility/bitvector.h:92:6: note: expanded from macro 'BV_CLR_ALL'
     memset((bv).vec, 0, sizeof((bv).vec));                                 \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/server/citytools.c:1193:14: warning: Array access (via field 'vec') results in a null pointer dereference [core.NullDereference]
        if (!BV_ISSET(could_see_unit[i], player_index(aplayer))
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/utility/bitvector.h:75:5: note: expanded from macro 'BV_ISSET'
   ((bv).vec[_BV_BYTE_INDEX(bit)] & _BV_BITMASK(bit)) != 0)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/server/citytools.c:1199:13: warning: Array access (via field 'vec') results in a null pointer dereference [core.NullDereference]
        if (BV_ISSET(could_see_unit[i], player_index(aplayer))) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/utility/bitvector.h:75:5: note: expanded from macro 'BV_ISSET'
   ((bv).vec[_BV_BYTE_INDEX(bit)] & _BV_BITMASK(bit)) != 0)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ticket History (3/6 Histories)

2023-05-08 14:39 Updated by: cazfi
  • New Ticket "transfer_city(): NULL could_see_uniti for BV_CLR_ALL(could_see_uniti)" created
2023-05-11 21:54 Updated by: cazfi
  • Summary Updated
2023-05-24 03:31 Updated by: cazfi
  • Summary Updated
2023-05-24 03:46 Updated by: cazfi
  • Owner Update from (None) to cazfi
  • Resolution Update from None to Accepted
2023-05-27 07:36 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

Please login to add comment to this ticket » Login