libtcod: Segfault during font loading with `TCOD_sys_check_magic_number`.

I have quite old code, that uses quite old tcod (1.5.1 somewhere before bitbucket umport)

Since that time TCOD migrated to SDL2 and this causes problems, I guess.

I’ve updated the code to be built with modern tcod, but it crashes. For tcods from 1.6.0 till 1.15.0 back trace is following:

#0  0x0000000000000000 in ?? ()
#1  0x00007ffff77adc7b in TCOD_sys_check_magic_number (filename=<optimized out>, size=2, data=0x7ffff7847820 <TCOD_sys_check_bmp(char const*)::magic_number> "BM") at ../../src/libtcod/sys_sdl_c.cpp:1861
#2  0x00007ffff77ad6f3 in TCOD_sys_load_image (filename=0x7ffff78479b8 <TCOD_ctx+24> "/home/nataraj/.config/goblin-camp/terminal.png") at ../../src/libtcod/sys_sdl_c.cpp:1718
#3  0x00007ffff77b047d in TCOD_sys_load_font () at ../../src/libtcod/sys_sdl_c.cpp:288
#4  TCOD_sys_init (console=console@entry=0x5555563692f0, fullscreen=fullscreen@entry=false) at ../../src/libtcod/sys_sdl_c.cpp:916
#5  0x00007ffff77cd79b in TCOD_console_init (con=con@entry=0x5555563692f0, title=..., fullscreen=fullscreen@entry=false) at ../../src/libtcod/console/console.cpp:77
#6  0x00007ffff77d4ea5 in tcod::console::init_root (w=100, h=75, title=..., fullscreen=<optimized out>, renderer=TCOD_RENDERER_SDL, vsync=false) at ../../src/libtcod/engine/display.cpp:151
#7  0x00007ffff77a502b in TCODConsole::initRoot (w=100, h=75, title=<optimized out>, fullscreen=false, renderer=TCOD_RENDERER_SDL) at ../../src/libtcod/console.cpp:150
#8  0x0000555555d1941e in Game::Init (this=0x555556317440, firstTime=true) at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/Game.cpp:601
#9  0x0000555555d144d1 in Game::Inst () at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/Game.cpp:113
#10 0x0000555555ec299c in (anonymous namespace)::LoadMod (dir=..., required=true) at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/data/Mods.cpp:156
#11 0x0000555555ec2b89 in Mods::Load () at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/data/Mods.cpp:202
#12 0x0000555555c6ef3d in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke (function_ptr=...) at /usr/include/boost/function/function_template.hpp:117
#13 0x0000555555c69950 in boost::function0<void>::operator() (this=0x7fffffffdd80) at /usr/include/boost/function/function_template.hpp:763
#14 0x0000555555d191a7 in Game::ProgressScreen(boost::function<void ()>, bool) (blockingCall=..., isLoading=true) at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/Game.cpp:539
#15 0x0000555555c66f38 in Game::LoadingScreen(boost::function<void ()>) (fn=...) at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/include/Game.hpp:126
#16 0x0000555555c5fd18 in GCMain (args=...) at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/GCamp.cpp:85
#17 0x0000555555c5f128 in main (argc=1, argv=0x7fffffffdfa8) at /home/nataraj/Projects/goblin-camp/goblin-camp/Goblin Camp/src/platform/unix/main.cpp:25

I’ve tried a lot of things, but they did not help. Where can I ask for help? Will it be good to do it here?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments