Ticket #48379

sdl2: real_units_report_dialog_update() pbuf NULL dereference

Date d'ouverture: 2023-07-10 12:59 Dernière mise à jour: 2023-07-16 17:35

Rapporteur:
Propriétaire:
Type:
État:
Atteints
Composant:
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
2

Détails

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
  • Propriétaire Update from (Aucun) to cazfi
  • Résolution Update from Aucun to Accepted
Commentaire

Patches for all branches, including S2_6, attached.

2023-07-16 17:35 Updated by: cazfi
  • État Update from Ouvert to Atteints
  • Résolution Update from Accepted to Fixed

Modifier

Please login to add comment to this ticket » Connexion