Ticket #48379

sdl2: real_units_report_dialog_update() pbuf NULL dereference

오픈 날짜: 2023-07-10 12:59 마지막 업데이트: 2023-07-16 17:35

Reporter:
소유자:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
2

Details

S3_1, clang analyzer:

../../../../src/client/gui-sdl2/repodlgs.c:946:25: warning: Access to field 'id' results in a dereference of a null pointer (loaded from variable 'pbuf') [core.NullDereference]
          if ((MAX_ID - pbuf->id) == utype_number(i)) {
                        ^~~~~~~~

Seems actual bug to me. pbuf gets assigned from pwidget which has been assigned (initially) from units_dlg->end_active_widget_list, that might has no value assigned at all since fc_calloc() set it NULL. That can happen when the player has no units at all.

Ticket History (3/5 Histories)

2023-07-10 12:59 Updated by: cazfi
  • New Ticket "sdl2: real_units_report_dialog_update() pbuf NULL dereference" created
2023-07-10 13:18 Updated by: cazfi
  • 소유자 Update from (None) to cazfi
  • Resolution Update from None to Accepted
댓글 올리기

Patches for all branches, including S2_6, attached.

2023-07-16 17:35 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