Ticket #45275

dai_spend_gold(): clang analyzer warning about NULL derefence from pcity

Open Date: 2022-07-30 12:12 Last Update: 2022-08-09 15:30

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

Details

Seen on S3_0: clang analyzer warns about pcity->anarchy in dai_spend_gold() to potentially be a NULL dereference.

I don't think it can ever be, as then also the bestchoice.value would be left to value 0, which causes loop to break before reaching that pcity->anarchy.

However, the coding style around there isn't really good considering that choice.want is a floating point number. It makes sense to refactor the code a bit, and presumably to get rid of the clang analyzer warning in the process.

Ticket History (3/4 Histories)

2022-07-30 12:12 Updated by: cazfi
  • New Ticket "dai_spend_gold(): clang analyzer warning about NULL derefence from pcity" created
2022-07-31 21:07 Updated by: cazfi
  • Owner Update from (None) to cazfi
  • Resolution Update from None to Accepted
2022-08-09 15:30 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login