Incidencia #48379

sdl2: real_units_report_dialog_update() pbuf NULL dereference

Abrir Fecha: 2023-07-10 12:59 Última actualización: 2023-07-16 17:35

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

Patches for all branches, including S2_6, attached.

2023-07-16 17:35 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Editar

Please login to add comment to this ticket » Entrar