{"action":"created","issue":{"url":"https://api.github.com/repos/EasyRPG/Player/issues/556","labels_url":"https://api.github.com/repos/EasyRPG/Player/issues/556/labels{/name}","comments_url":"https://api.github.com/repos/EasyRPG/Player/issues/556/comments","events_url":"https://api.github.com/repos/EasyRPG/Player/issues/556/events","html_url":"https://github.com/EasyRPG/Player/issues/556","id":104740430,"number":556,"title":"The Sacred Tears TRUE: Crash in savegame scene","user":{"login":"fdelapena","id":174885,"avatar_url":"https://avatars.githubusercontent.com/u/174885?v=3","gravatar_id":"","url":"https://api.github.com/users/fdelapena","html_url":"https://github.com/fdelapena","followers_url":"https://api.github.com/users/fdelapena/followers","following_url":"https://api.github.com/users/fdelapena/following{/other_user}","gists_url":"https://api.github.com/users/fdelapena/gists{/gist_id}","starred_url":"https://api.github.com/users/fdelapena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdelapena/subscriptions","organizations_url":"https://api.github.com/users/fdelapena/orgs","repos_url":"https://api.github.com/users/fdelapena/repos","events_url":"https://api.github.com/users/fdelapena/events{/privacy}","received_events_url":"https://api.github.com/users/fdelapena/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/EasyRPG/Player/labels/Crash","name":"Crash","color":"800000"},{"url":"https://api.github.com/repos/EasyRPG/Player/labels/Savegames","name":"Savegames","color":"e102d8"},{"url":"https://api.github.com/repos/EasyRPG/Player/labels/Testcase%20available","name":"Testcase available","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-03T17:06:25Z","updated_at":"2015-12-18T23:55:51Z","closed_at":null,"body":"How to reproduce:\r\n- Download [The Sacred Tears TRUE game demo](http://sacredtearstrue.com/demo)\r\n- Play a bit until reaching the accessible game menu\r\n- Game menu -> Save game -> select a game file slot and save\r\n- Go to the main menu\r\n- Load game\r\n\r\nAlso reproducible while trying to access save scene. It crashes while trying to read some game slot data.\r\n\r\nIt works properly with generated RPG_RT savegames, so Player is creating corrupted savegames.\r\n\r\nProgram crashes with:\r\n\r\n    src/ldb_eventcommand.cpp:151: static void RawStruct<std::vector<RPG::EventCommand> >::ReadLcf(std::vector<RPG::EventCommand>&, LcfReader&, uint32_t): Assertion `stream.Tell() == endpos' failed\r\n\r\nBacktrace:\r\n```gdb\r\nProgram received signal SIGABRT, Aborted.\r\n0x00007ffff2dad9c8 in __GI_raise (sig=sig@entry=6)\r\n    at ../sysdeps/unix/sysv/linux/raise.c:55\r\n55\t  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);\r\n#0  0x00007ffff2dad9c8 in __GI_raise (sig=sig@entry=6)\r\n    at ../sysdeps/unix/sysv/linux/raise.c:55\r\n        resultvar = 0\r\n        pid = 5964\r\n        selftid = 5964\r\n#1  0x00007ffff2daf65a in __GI_abort () at abort.c:89\r\n        save_stage = 2\r\n        act = {__sigaction_handler = {sa_handler = 0x4, sa_sigaction = 0x4}, \r\n          sa_mask = {__val = {4436966, 140737488344880, 140737488344768, \r\n              47244640256, 0, 0, 0, 21474836480, 140737269203742, \r\n              140737488344920, 140737488344720, 140737269215640, \r\n              140737269222720, 140737488344944, 140737353990144, \r\n              140737348645428}}, sa_flags = 151, \r\n          sa_restorer = 0x7ffff7ac3280 <RawStruct<std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> > >::ReadLcf(std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> >&, LcfReader&, unsigned int)::__PRETTY_FUNCTION__>}\r\n        sigs = {__val = {32, 0 <repeats 15 times>}}\r\n#2  0x00007ffff2da6187 in __assert_fail_base (fmt=<optimized out>, \r\n    assertion=assertion@entry=0x7ffff7ac3234 \"stream.Tell() == endpos\", \r\n    file=file@entry=0x7ffff7ac321b \"src/ldb_eventcommand.cpp\", \r\n    line=line@entry=151, \r\n    function=function@entry=0x7ffff7ac3280 <RawStruct<std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> > >::ReadLcf(std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> >&, LcfReader&, unsigned int)::__PRETTY_FUNCTION__> \"static void RawStruct<std::vector<RPG::EventCommand> >::ReadLcf(std::vector<RPG::EventCommand>&, LcfReader&, uint32_t)\") at assert.c:92\r\n        str = 0x380fe00 \"0\\377\\200\\003\"\r\n        total = 4096\r\n#3  0x00007ffff2da6232 in __GI___assert_fail (\r\n    assertion=0x7ffff7ac3234 \"stream.Tell() == endpos\", \r\n    file=0x7ffff7ac321b \"src/ldb_eventcommand.cpp\", line=151, \r\n    function=0x7ffff7ac3280 <RawStruct<std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> > >::ReadLcf(std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> >&, LcfReader&, unsigned int)::__PRETTY_FUNCTION__> \"static void RawStruct<std::vector<RPG::EventCommand> >::ReadLcf(std::vector<RPG::EventCommand>&, LcfReader&, uint32_t)\") at assert.c:101\r\nNo locals.\r\n#4  0x00007ffff792de82 in RawStruct<std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> > >::ReadLcf (\r\n    event_commands=std::vector of length 313, capacity 512 = {...}, \r\n    stream=..., length=3416) at src/ldb_eventcommand.cpp:151\r\n        startpos = 12062\r\n        endpos = 15478\r\n        __PRETTY_FUNCTION__ = \"static void RawStruct<std::vector<RPG::EventCommand> >::ReadLcf(std::vector<RPG::EventCommand>&, LcfReader&, uint32_t)\"\r\n#5  0x00007ffff7a884d7 in TypeReader<std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> >, (Category::Index)3>::ReadLcf (\r\n    ref=std::vector of length 313, capacity 512 = {...}, stream=..., \r\n    length=3416) at ./src/reader_struct.h:98\r\nNo locals.\r\n#6  0x00007ffff7aac49e in TypedField<RPG::SaveEventCommands, std::vector<RPG::EventCommand, std::allocator<RPG::EventCommand> > >::ReadLcf (this=0x88f580, \r\n    obj=..., stream=..., length=3416) at ./src/reader_struct.h:363\r\nNo locals.\r\n#7  0x00007ffff7958dc7 in Struct<RPG::SaveEventCommands>::ReadLcf (obj=..., \r\n    stream=...) at src/reader_struct.cpp:55\r\n        it = {first = 2, second = }\r\n        chunk_info = {ID = 2, length = 3416}\r\n#8  0x00007ffff797fb08 in TypeReader<RPG::SaveEventCommands, (Category::Index)1>::ReadLcf (ref=..., stream=...) at src/reader_struct.h:534\r\nNo locals.\r\n#9  0x00007ffff795932b in Struct<RPG::SaveEventCommands>::ReadLcf (\r\n    vec=std::vector of length 1, capacity 1 = {...}, stream=...)\r\n    at src/reader_struct.cpp:189\r\n        i = 0\r\n        count = 1\r\n#10 0x00007ffff7aad6ee in TypeReader<std::vector<RPG::SaveEventCommands, std::allocator<RPG::SaveEventCommands> >, (Category::Index)1>::ReadLcf (\r\n    ref=std::vector of length 1, capacity 1 = {...}, stream=...)\r\n    at ./src/reader_struct.h:556\r\nNo locals.\r\n#11 0x00007ffff7aae3a2 in TypedField<RPG::SaveEvents, std::vector<RPG::SaveEventCommands, std::allocator<RPG::SaveEventCommands> > >::ReadLcf (this=0x88fa60, \r\n    obj=..., stream=..., length=3430) at ./src/reader_struct.h:363\r\nNo locals.\r\n#12 0x00007ffff795a093 in Struct<RPG::SaveEvents>::ReadLcf (obj=..., \r\n    stream=...) at src/reader_struct.cpp:55\r\n        it = {first = 1, second = }\r\n        chunk_info = {ID = 1, length = 3430}\r\n#13 0x00007ffff7980872 in TypeReader<RPG::SaveEvents, (Category::Index)1>::ReadLcf (ref=..., stream=...) at src/reader_struct.h:534\r\nNo locals.\r\n#14 0x00007ffff7aa92ac in TypedField<RPG::Save, RPG::SaveEvents>::ReadLcf (\r\n    this=0x88f4f0, obj=..., stream=..., length=3437)\r\n    at ./src/reader_struct.h:363\r\nNo locals.\r\n#15 0x00007ffff795728b in Struct<RPG::Save>::ReadLcf (obj=..., stream=...)\r\n    at src/reader_struct.cpp:55\r\n        it = {first = 113, second = }\r\n        chunk_info = {ID = 113, length = 3437}\r\n#16 0x00007ffff79374fe in LSD_Reader::Load (filename=\"./Save01.lsd\", \r\n    encoding=\"ibm-5348_P100-1997\") at src/lsd_reader.cpp:45\r\n        reader = {filename = \"./Save01.lsd\", encoding = \"ibm-5348_P100-1997\", \r\n          stream = 0x2b27c90, static error_str = \"\"}\r\n        header = \"LcfSaveData\"\r\n        save = 0x2b27ec0\r\n#17 0x000000000053f9ca in Scene_File::Start (this=0x2ce38c0)\r\n    at src/scene_file.cpp:70\r\n        savegame = {_M_ptr = 0x865ff0 <Input::triggered>}\r\n        w = {px = 0x2b27700, pn = {pi_ = 0x30d8a70}}\r\n        ss = \r\n    {<std::basic_iostream<char, std::char_traits<char> >> = {<std::basic_istream<char, std::char_traits<char> >> = {<std::basic_ios<char, std::char_traits<char> >> = {<std::ios_base> = {\r\n                  _vptr.ios_base = 0x7ffff39cf010 <vtable for std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >+104>, \r\n                  static boolalpha = std::_S_boolalpha, \r\n                  static dec = std::_S_dec, static fixed = std::_S_fixed, \r\n                  static hex = std::_S_hex, \r\n                  static internal = std::_S_internal, \r\n                  static left = std::_S_left, static oct = std::_S_oct, \r\n                  static right = std::_S_right, \r\n                  static scientific = std::_S_scientific, \r\n                  static showbase = std::_S_showbase, \r\n                  static showpoint = std::_S_showpoint, \r\n                  static showpos = std::_S_showpos, \r\n                  static skipws = std::_S_skipws, \r\n                  static unitbuf = std::_S_unitbuf, \r\n                  static uppercase = std::_S_uppercase, \r\n                  static adjustfield = std::_S_adjustfield, \r\n                  static basefield = std::_S_basefield, \r\n                  static floatfield = std::_S_floatfield, \r\n                  static badbit = std::_S_badbit, \r\n                  static eofbit = std::_S_eofbit, \r\n                  static failbit = std::_S_failbit, \r\n                  static goodbit = std::_S_goodbit, static app = std::_S_app, \r\n                  static ate = std::_S_ate, static binary = std::_S_bin, \r\n                  static in = std::_S_in, static out = std::_S_out, \r\n                  static trunc = std::_S_trunc, static beg = std::_S_beg, \r\n                  static cur = std::_S_cur, static end = std::_S_end, \r\n                  _M_precision = 6, _M_width = 0, _M_flags = 4098, \r\n                  _M_exception = std::_S_goodbit, \r\n                  _M_streambuf_state = std::_S_goodbit, _M_callbacks = 0x0, \r\n                  _M_word_zero = {_M_pword = 0x0, _M_iword = 0}, \r\n                  _M_local_word = {{_M_pword = 0x0, _M_iword = 0}, {\r\n                      _M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, \r\n                      _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {\r\n                      _M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, \r\n                      _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {\r\n                      _M_pword = 0x0, _M_iword = 0}}, _M_word_size = 8, \r\n                  _M_word = 0x7fffffffdd18, _M_ios_locale = {static none = 0, \r\n                    static ctype = 1, static numeric = 2, static collate = 4, \r\n                    static time = 8, static monetary = 16, \r\n                    static messages = 32, static all = 63, \r\n                    _M_impl = 0x7ffff39d8860 <(anonymous namespace)::c_locale_impl>, \r\n                    static _S_classic = 0x7ffff39d8860 <(anonymous namespace)::c_locale_impl>, \r\n                    static _S_global = 0x7ffff39d8860 <(anonymous namespace)::c_locale_impl>, \r\n                    static _S_categories = 0x7ffff39cb1e0 <__gnu_cxx::category_names>, static _S_once = 2}}, _M_tie = 0x0, _M_fill = 32 ' ', _M_fill_init = true, \r\n                _M_streambuf = 0x7fffffffdc88, \r\n                _M_ctype = 0x7ffff39d8280 <(anonymous namespace)::ctype_c>, \r\n                _M_num_put = 0x7ffff39d8210 <(anonymous namespace)::num_put_c>, _M_num_get = 0x7ffff39d8220 <(anonymous namespace)::num_get_c>}, \r\n              _vptr.basic_istream = 0x7ffff39cefc0 <vtable for std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >+24>, \r\n              _M_gcount = 0}, <std::basic_ostream<char, std::char_traits<char> >> = {\r\n              _vptr.basic_ostream = 0x7ffff39cefe8 <vtable for std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >+64>}, <No data fields>}, \r\n          _M_stringbuf = {<std::basic_streambuf<char, std::char_traits<char> >> = {\r\n              _vptr.basic_streambuf = 0x7ffff39cec50 <vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >+16>, \r\n              _M_in_beg = 0x2b27a18 \"Save01.lsd 1\", \r\n              _M_in_cur = 0x2b27a18 \"Save01.lsd 1\", \r\n              _M_in_end = 0x2b27a19 \"ave01.lsd 1\", \r\n              _M_out_beg = 0x2b27a18 \"Save01.lsd 1\", \r\n              _M_out_cur = 0x2b27a22 \" 1\", \r\n              _M_out_end = 0x2b27c18 \"\\350d\\262\\002\", _M_buf_locale = {\r\n                static none = 0, static ctype = 1, static numeric = 2, \r\n                static collate = 4, static time = 8, static monetary = 16, \r\n                static messages = 32, static all = 63, \r\n                _M_impl = 0x7ffff39d8860 <(anonymous namespace)::c_locale_impl>, static _S_classic = 0x7ffff39d8860 <(anonymous namespace)::c_locale_impl>, \r\n                static _S_global = 0x7ffff39d8860 <(anonymous namespace)::c_locale_impl>, static _S_categories = 0x7ffff39cb1e0 <__gnu_cxx::category_names>, \r\n                static _S_once = 2}}, _M_mode = (std::_S_in | std::_S_out), \r\n            _M_string = \"S\"}}\r\n        file = \"./Save01.lsd\"\r\n        i = 0\r\n#18 0x0000000000456266 in Scene::MainFunction (this=0x2ce38c0)\r\n    at src/scene.cpp:78\r\n        init = false\r\n        __PRETTY_FUNCTION__ = \"virtual void Scene::MainFunction()\"\r\n#19 0x000000000043dc53 in Player::MainLoop () at src/player.cpp:178\r\nNo locals.\r\n#20 0x000000000043dbdc in Player::Run () at src/player.cpp:173\r\nNo locals.\r\n#21 0x0000000000431f15 in main (argc=2, argv=0x7fffffffe028)\r\n    at src/platform/sdl_main.cpp:31\r\nNo locals.\r\n```"},"comment":{"url":"https://api.github.com/repos/EasyRPG/Player/issues/comments/165923087","html_url":"https://github.com/EasyRPG/Player/issues/556#issuecomment-165923087","issue_url":"https://api.github.com/repos/EasyRPG/Player/issues/556","id":165923087,"user":{"login":"Ghabry","id":1331889,"avatar_url":"https://avatars.githubusercontent.com/u/1331889?v=3","gravatar_id":"","url":"https://api.github.com/users/Ghabry","html_url":"https://github.com/Ghabry","followers_url":"https://api.github.com/users/Ghabry/followers","following_url":"https://api.github.com/users/Ghabry/following{/other_user}","gists_url":"https://api.github.com/users/Ghabry/gists{/gist_id}","starred_url":"https://api.github.com/users/Ghabry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ghabry/subscriptions","organizations_url":"https://api.github.com/users/Ghabry/orgs","repos_url":"https://api.github.com/users/Ghabry/repos","events_url":"https://api.github.com/users/Ghabry/events{/privacy}","received_events_url":"https://api.github.com/users/Ghabry/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T23:55:51Z","updated_at":"2015-12-18T23:55:51Z","body":"Sounds like a liblcf bug? Would be probably nice to get fixed before 0.4. Will give it a try on Monday. But sounds like some work and reader_struct will be involved *ugh*"}}