We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5186 - SDL_BlitCopy crashes on mac OS 10.14 with specific file
Summary: SDL_BlitCopy crashes on mac OS 10.14 with specific file
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.12
Hardware: x86_64 macOS 10.14
: P2 critical
Assignee: Sylvain
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-11 19:54 UTC by Tobbi
Modified: 2020-06-21 19:49 UTC (History)
0 users

See Also:


Attachments
icechunk.png - the file causing the crash (15.21 KB, image/png)
2020-06-11 19:54 UTC, Tobbi
Details
full backtrace (with debug symbols) (6.67 KB, text/plain)
2020-06-11 20:48 UTC, Tobbi
Details
attempt of test-case (1.76 KB, text/x-csrc)
2020-06-17 20:01 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobbi 2020-06-11 19:54:33 UTC
Created attachment 4380 [details]
icechunk.png - the file causing the crash

I'm sorry that this is gonna be a fairly vague bug report, but here it goes:

I noticed that SuperTux crashes in SDL-related functions with a specific file. The backtrace is as follows with this commit https://github.com/SuperTux/supertux/commit/5d0587e97937b4ab416a79c4d603b95862aab8b9:

The line where it crashes is this one here:
https://github.com/SuperTux/supertux/blob/5d0587e97937b4ab416a79c4d603b95862aab8b9/src/video/gl/gl_texture.cpp#L97

Since it crashes only with that one file, I assume it's something within the file that causes it to crash. If anyone could find out what it is, I'd be grateful. 

Here's the stacktrace for the crash:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x11c9ce020)
  * frame #0: 0x0000000102322d29 libSDL2-2.0.0.dylib`SDL_BlitCopy + 233
    frame #1: 0x00000001022fc246 libSDL2-2.0.0.dylib`SDL_SoftBlit + 306
    frame #2: 0x000000010232a88e libSDL2-2.0.0.dylib`SDL_UpperBlit_REAL + 407
    frame #3: 0x0000000100639004 supertux2`GLTexture::GLTexture(this=0x000000011b3583f0, image=0x000000011b358310, sampler=0x00007ffeefbfc818) at gl_texture.cpp:97:3
    frame #4: 0x0000000100639825 supertux2`GLTexture::GLTexture(this=0x000000011b3583f0, image=0x000000011b358310, sampler=0x00007ffeefbfc818) at gl_texture.cpp:77:1
    frame #5: 0x0000000100642215 supertux2`GLVideoSystem::new_texture(this=0x000000010631b540, image=0x000000011b358310, sampler=0x00007ffeefbfc818) at gl_video_system.cpp:286:25
    frame #6: 0x00000001006664ab supertux2`TextureManager::create_image_texture_raw(this=0x00000001063528c0, filename="/images/tiles/snow/icechunk.png", rect=(t=128, l=0, b=160, r=32), sampler=0x00007ffeefbfc818) at texture_manager.cpp:324:34
    frame #7: 0x0000000100665e0d supertux2`TextureManager::create_image_texture(this=0x00000001063528c0, filename="/images/tiles/snow/icechunk.png", rect=(t=128, l=0, b=160, r=32), sampler=0x00007ffeefbfc818) at texture_manager.cpp:261:12
    frame #8: 0x00000001006653eb supertux2`TextureManager::get(this=0x00000001063528c0, _filename="images/tiles/snow/icechunk.png", rect=0x00007ffeefbfca10, sampler=0x00007ffeefbfc818) at texture_manager.cpp:228:17
    frame #9: 0x000000010065dd04 supertux2`Surface::from_file(filename="images/tiles/snow/icechunk.png", rect=0x00007ffeefbfd630) at surface.cpp:78:55
    frame #10: 0x00000001005bc711 supertux2`TileSetParser::parse_imagespecs(this=0x00007ffeefbfd968, images_mapping=0x00007ffeefbfd650, surface_region=0x00007ffeefbfd630) const at tile_set_parser.cpp:334:26
    frame #11: 0x00000001005bc065 supertux2`TileSetParser::parse_tiles(this=0x00007ffeefbfd968, reader=0x00007ffeefbfd7a0) at tile_set_parser.cpp:298:24
    frame #12: 0x00000001005b9b0d supertux2`TileSetParser::parse(this=0x00007ffeefbfd968) at tile_set_parser.cpp:72:7
    frame #13: 0x00000001005b2dc1 supertux2`TileSet::from_file(filename="images/tiles.strf") at tile_set.cpp:41:10
    frame #14: 0x00000001005af2d2 supertux2`TileManager::get_tileset(this=0x00007ffeefbff360, filename="images/tiles.strf") at tile_manager.cpp:38:20
    frame #15: 0x0000000100487839 supertux2`GameObjectFactory::init_factories(this=0x00000001063915a8, reader=0x00007ffeefbfdf88)::$_0::operator()(ReaderMapping const&) const at game_object_factory.cpp:264:46
    frame #16: 0x0000000100487784 supertux2`decltype(__f=0x00000001063915a8, __args=0x00007ffeefbfdf88)::$_0&>(fp)(std::__1::forward<ReaderMapping const&>(fp0))) std::__1::__invoke<GameObjectFactory::init_factories()::$_0&, ReaderMapping const&>(GameObjectFactory::init_factories()::$_0&, ReaderMapping const&) at type_traits:4361:1
    frame #17: 0x00000001004876f4 supertux2`std::__1::unique_ptr<GameObject, std::__1::default_delete<GameObject> > std::__1::__invoke_void_return_wrapper<std::__1::unique_ptr<GameObject, std::__1::default_delete<GameObject> > >::__call<GameObjectFactory::init_factories(__args=0x00000001063915a8, __args=0x00007ffeefbfdf88)::$_0&, ReaderMapping const&>(GameObjectFactory::init_factories()::$_0&, ReaderMapping const&) at __functional_base:318:16
    frame #18: 0x00000001004876a4 supertux2`std::__1::__function::__alloc_func<GameObjectFactory::init_factories()::$_0, std::__1::allocator<GameObjectFactory::init_factories()::$_0>, std::__1::unique_ptr<GameObject, std::__1::default_delete<GameObject> > (ReaderMapping const&)>::operator(this=0x00000001063915a8, __arg=0x00007ffeefbfdf88)(ReaderMapping const&) at functional:1527:16
    frame #19: 0x00000001004863d3 supertux2`std::__1::__function::__func<GameObjectFactory::init_factories()::$_0, std::__1::allocator<GameObjectFactory::init_factories()::$_0>, std::__1::unique_ptr<GameObject, std::__1::default_delete<GameObject> > (ReaderMapping const&)>::operator(this=0x00000001063915a0, __arg=0x00007ffeefbfdf88)(ReaderMapping const&) at functional:1651:12
    frame #20: 0x000000010056c0c7 supertux2`std::__1::__function::__value_func<std::__1::unique_ptr<GameObject, std::__1::default_delete<GameObject> > (ReaderMapping const&)>::operator(this=0x00000001063915a0, __args=0x00007ffeefbfdf88)(ReaderMapping const&) const at functional:1799:16
    frame #21: 0x0000000100569f8f supertux2`std::__1::function<std::__1::unique_ptr<GameObject, std::__1::default_delete<GameObject> > (ReaderMapping const&)>::operator(this=0x00000001063915a0, __arg=0x00007ffeefbfdf88)(ReaderMapping const&) const at functional:2347:12
    frame #22: 0x0000000100569d1a supertux2`ObjectFactory::create(this=0x00000001007c0488, name="tilemap", reader=0x00007ffeefbfdf88) const at object_factory.cpp:42:12
    frame #23: 0x0000000100599b5d supertux2`SectorParser::parse_object(this=0x00007ffeefbfe168, name_="tilemap", reader=0x00007ffeefbfdf88) at sector_parser.cpp:89:44
    frame #24: 0x00000001005979a8 supertux2`SectorParser::parse(this=0x00007ffeefbfe168, sector=0x00007ffeefbfe368) at sector_parser.cpp:141:21
    frame #25: 0x0000000100597172 supertux2`SectorParser::from_reader(level=0x0000000106486010, reader=0x00007ffeefbfe368, editable=false) at sector_parser.cpp:52:10
    frame #26: 0x00000001004be826 supertux2`LevelParser::load(this=0x00007ffeefbfe710, doc=0x00007ffeefbfe698) at level_parser.cpp:174:23
    frame #27: 0x00000001004bd554 supertux2`LevelParser::load(this=0x00007ffeefbfe710, filepath="levels/misc/menu.stl") at level_parser.cpp:138:5
    frame #28: 0x00000001004bd489 supertux2`LevelParser::from_file(filename="levels/misc/menu.stl", worldmap=false, editable=false) at level_parser.cpp:70:10
    frame #29: 0x000000010049b32d supertux2`GameSession::restart_level(this=0x000000010657f150, after_death=false) at game_session.cpp:120:15
    frame #30: 0x000000010049aec3 supertux2`GameSession::GameSession(this=0x000000010657f150, levelfile_="levels/misc/menu.stl", savegame=0x0000000106566390, statistics=0x0000000000000000) at game_session.cpp:76:7
    frame #31: 0x000000010049b9fd supertux2`GameSession::GameSession(this=0x000000010657f150, levelfile_="levels/misc/menu.stl", savegame=0x0000000106566390, statistics=0x0000000000000000) at game_session.cpp:75:1
    frame #32: 0x00000001005c1efd supertux2`TitleScreen::TitleScreen(this=0x000000010657e470, savegame=0x0000000106566390) at title_screen.cpp:41:22
    frame #33: 0x00000001005c25bd supertux2`TitleScreen::TitleScreen(this=0x000000010657e470, savegame=0x0000000106566390) at title_screen.cpp:48:1
    frame #34: 0x00000001004d142e supertux2`std::__1::__unique_if<TitleScreen>::__unique_single std::__1::make_unique<TitleScreen, Savegame&>(__args=0x0000000106566390) at memory:3132:32
    frame #35: 0x00000001004d07b0 supertux2`Main::launch_game(this=0x00007ffeefbff8b8, args=0x00007ffeefbff730) at main.cpp:530:34
    frame #36: 0x00000001004d1b39 supertux2`Main::run(this=0x00007ffeefbff8b8, argc=1, argv=0x00007ffeefbff8f8) at main.cpp:604:9
    frame #37: 0x0000000100007a7f supertux2`main(argc=1, argv=0x00007ffeefbff8f8) at main.cpp:23:17
    frame #38: 0x00007fff64b033d5 libdyld.dylib`start + 1
    frame #39: 0x00007fff64b033d5 libdyld.dylib`start + 1
Comment 1 Tobbi 2020-06-11 20:48:03 UTC
Created attachment 4381 [details]
full backtrace (with debug symbols)
Comment 2 Sam Lantinga 2020-06-11 21:50:26 UTC
Hey Sylvain, this isn't a Mac issue, it's a format conversion issue. Can you take a look?
Comment 3 Sylvain 2020-06-17 20:01:57 UTC
Created attachment 4388 [details]
attempt of test-case

Hey,
I can't reproduce your issue Tobbi, see the test-case while converting to 4 rgba format. (tried with latest hg sources).

The image file is quite standard: SDL_PIXELFORMAT_ABGR8888, 128 x 128, pitch=512
so it's strange to have an issue with this.

You code seems also correct.

But the commit you point is totally unrelated, so maybe it would be good to run you code with valgrind or something.
Comment 4 Tobbi 2020-06-17 22:13:20 UTC
By pure coincidence, the bug is fixed with the latest master version of SuperTux.

I identified the commit that fixed the bug as 7d3f96ad890a35a2e2c6b36c24441de49d9e2d66

In particular, the lines that fixed this are

https://github.com/SuperTux/supertux/commit/7d3f96ad890a35a2e2c6b36c24441de49d9e2d66#diff-f4868f0781e6c34b4ef6d2f0ce13a5e3R5357-R5373

The supertux tile format splits a particular image into squares of dimension 32x32 and calculates the size of the image that way.

I will have to find out how we pass the calculated size of that to SDL.
Comment 5 Sylvain 2020-06-21 19:49:31 UTC
ok, so I marked this as invalid. 
The reason looks suspicious and I would run the app with valgrind if I were you.
Comment 6 Sylvain 2020-06-21 19:49:58 UTC
marked as invalid