#48379: sdl2: real_units_report_dialog_update() pbuf NULL dereference Open Date: 2023-07-10 06:59 Last Update: 2023-07-10 06:59 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/48379 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48379 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2023-07-10 06:59 Updated by: cazfi * New Ticket "sdl2: real_units_report_dialog_update() pbuf NULL dereference" created --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: (None) Type: Bugs Status: Open Priority: 5 - Medium MileStone: 3.0.9 Component: SDL2-client Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket 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 information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/48379 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48379