待辦事項 #46099

sdl2: clang analyzer NULL dereference warning about unit_select_dialog_popup()

啟用日期: 2022-11-23 05:30 最後更新: 2022-11-28 07:17

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
2

細節

S3_0 (but other branches likely affected): unit_select_dialog_popup() does unit_tile(pUnit). Clang analyzer is worried that it causes reference through NULL pUnit. That's not real problem, as if the tile unit list size is zero, we never reach that part, and pUnit is the topmost unit in the stack.

However, the code makes no sense, either. We already know that the unit is in the list of the original ptile, so certainly its tile is ptile. No need to seek for that. If that was not the case, we would be looking value from effectively random unit from the stack like representing all of them.

Ticket History (3/5 Histories)

2022-11-23 05:30 Updated by: cazfi
  • New Ticket "sdl2: clang analyzer NULL dereference warning about unit_select_dialog_popup()" created
2022-11-23 05:52 Updated by: cazfi
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from to Accepted
2022-11-28 07:17 Updated by: cazfi
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

編輯

Please login to add comment to this ticket » 登入