Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LT79] Assertion nullptr != src failed #2032

Closed
3dsf opened this issue Sep 8, 2023 · 3 comments · Fixed by #2086
Closed

[LT79] Assertion nullptr != src failed #2032

3dsf opened this issue Sep 8, 2023 · 3 comments · Fixed by #2086
Labels
bug Something isn't working gui This issue requires changes to the user interface server This issue requires changes to the server

Comments

@3dsf
Copy link

3dsf commented Sep 8, 2023

Describe the bug

[warning] freeciv21-client - libpng warning: iCCP: known incorrect sRGB profile
[info] freeciv21-client - Loading tileset "amplio2".
[critical] freeciv21-client - Assertion nullptr != src failed
[critical] freeciv21-client - Please report this message at https://github.com/longturn/freeciv21/issues
[critical] freeciv21-client - Assertion nullptr != src failed
[critical] freeciv21-client - Please report this message at https://github.com/longturn/freeciv21/issues

To Reproduce

  1. Log into lt79 using client from cmd line w/ username/password

Expected behavior

  • No error message

Platform and version:

  • OS: Linux
  • Freeciv21 version: 3.1.787087.3-alpha
  • Ruleset/Longturn game (if applicable): lt79 after 2 boat landing units feature elimination

Additional context

  • Client works and no unexpected behaviour observed
@3dsf 3dsf added bug Something isn't working Untriaged This issue or PR needs triaging labels Sep 8, 2023
@lmoureaux
Copy link
Contributor

lmoureaux commented Sep 9, 2023

Backtrace:

#0  fc_assert_handle_failure(char const*, char const*, int, char const*, QString const&)
    (condition=0x555555b6ae8e "nullptr != src", file=0x555555b6ae08 "/home/louis/Personal/freeciv21/utility/support.cpp", line=416, function=0x555555b6ae50 "size_t fc_strlcpy(char*, const char*, size_t)", message=...) at /home/louis/Personal/freeciv21/utility/log.cpp:224
#1  0x0000555555a76925 in fc_strlcpy(char*, char const*, unsigned long) (dest=0x7ffffffec14a "", src=0x0, n=4070) at /home/louis/Personal/freeciv21/utility/support.cpp:416
#2  0x0000555555a76c49 in fc_strlcat(char*, char const*, unsigned long) (dest=0x7ffffffec14a "", src=0x0, n=4070) at /home/louis/Personal/freeciv21/utility/support.cpp:457
#3  0x00005555558c4cf5 in universal_name_translation(universal const*, char*, unsigned long) (psource=0x555559931d60, buf=0x7ffffffec14a "", bufsz=4070)
    at /home/louis/Personal/freeciv21/common/requirements.cpp:4337
#4  0x000055555584d7ba in get_effect_req_text(effect const*, char*, unsigned long) (peffect=0x555559931cb0, buf=0x7ffffffec130 "not Mood+not Histoire+not ", buf_len=4096)
    at /home/louis/Personal/freeciv21/common/effects.cpp:1030
#5  0x0000555555862ca1 in boot_help_texts(nation_set const*, help_item*) (nations_to_show=0x0, tileset_help=0x5555560ebd30) at /home/louis/Personal/freeciv21/common/helpdata.cpp:1025
#6  0x000055555579436c in tilespec_reread(QString const&, bool) (name=..., game_fully_initialized=true) at /home/louis/Personal/freeciv21/client/tileset/tilespec.cpp:1043
#7  0x0000555555794aba in tilespec_reread_frozen_refresh(QString const&) (name=...) at /home/louis/Personal/freeciv21/client/tileset/tilespec.cpp:1171
#8  0x00005555556fb3d4 in handle_set_topology(int) (topology_id=7) at /home/louis/Personal/freeciv21/client/packhand.cpp:2043
#9  0x0000555555820f15 in client_handle_packet(packet_type, void const*) (type=PACKET_SET_TOPOLOGY, packet=0x555559dae340) at /home/louis/Personal/freeciv21/build/client/packhand_gen.cpp:517
#10 0x000055555561ba54 in client_packet_input(void*, int) (packet=0x555559dae340, type=253) at /home/louis/Personal/freeciv21/client/client_main.cpp:701
#11 0x0000555555624bb8 in input_from_server(QTcpSocket*) (sock=0x55555626f010) at /home/louis/Personal/freeciv21/client/clinet.cpp:292

get_effect_req_text seems to get a garbage psource->value.nintel

(gdb) print psource->value.nintel
$2 = 4294967295

(this is unsigned(-1))

@lmoureaux
Copy link
Contributor

Seems related to this requirement in the ruleset

@lmoureaux
Copy link
Contributor

There is just no Infra Points national intelligence value.

freeciv21/common/fc_types.h

Lines 532 to 555 in c028f42

#define SPECENUM_NAME national_intelligence
#define SPECENUM_VALUE0 NI_MULTIPLIERS
#define SPECENUM_VALUE0NAME N_("Multipliers")
#define SPECENUM_VALUE1 NI_WONDERS
#define SPECENUM_VALUE1NAME N_("Wonders")
#define SPECENUM_VALUE2 NI_SCORE
#define SPECENUM_VALUE2NAME N_("Score")
#define SPECENUM_VALUE3 NI_GOLD
#define SPECENUM_VALUE3NAME N_("Gold")
#define SPECENUM_VALUE4 NI_GOVERNMENT
#define SPECENUM_VALUE4NAME N_("Government")
#define SPECENUM_VALUE5 NI_DIPLOMACY
#define SPECENUM_VALUE5NAME N_("Diplomacy")
#define SPECENUM_VALUE6 NI_TECHS
#define SPECENUM_VALUE6NAME N_("Techs")
#define SPECENUM_VALUE7 NI_TAX_RATES
#define SPECENUM_VALUE7NAME N_("Tax Rates")
#define SPECENUM_VALUE8 NI_CULTURE
#define SPECENUM_VALUE8NAME N_("Culture")
#define SPECENUM_VALUE9 NI_MOOD
#define SPECENUM_VALUE9NAME N_("Mood")
#define SPECENUM_VALUE10 NI_HISTORY
#define SPECENUM_VALUE10NAME N_("History")
#define SPECENUM_COUNT NI_COUNT

Server bug: should have caught this at ruleset load time and either ignored the effect or failed to load. Client bug: should validate what the server is sending.

@lmoureaux lmoureaux added gui This issue requires changes to the user interface server This issue requires changes to the server and removed Untriaged This issue or PR needs triaging labels Sep 9, 2023
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Dec 25, 2023
Check that the value of enum-based requirements is valid and fail otherwise.

See longturn#2032.
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Dec 25, 2023
Checks are copied from universal_value_from_str().

We don't fail when encountering invalid requirements because we want to keep
forward compatibility and new requirement types are added often. Instead we set
them to the "none" requirement so we don't try to interpret them.

Closes longturn#2032.
lmoureaux added a commit that referenced this issue Dec 26, 2023
Check that the value of enum-based requirements is valid and fail otherwise.

See #2032.
lmoureaux added a commit that referenced this issue Dec 26, 2023
Checks are copied from universal_value_from_str().

We don't fail when encountering invalid requirements because we want to keep
forward compatibility and new requirement types are added often. Instead we set
them to the "none" requirement so we don't try to interpret them.

Closes #2032.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gui This issue requires changes to the user interface server This issue requires changes to the server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants