{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19566","repository_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19566/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19566/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19566/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/issues/19566","id":192669339,"number":19566,"title":"Undefined behavior due to item_factory::m_templates map scrambling","user":{"login":"Coolthulhu","id":1878860,"avatar_url":"https://avatars.githubusercontent.com/u/1878860?v=3","gravatar_id":"","url":"https://api.github.com/users/Coolthulhu","html_url":"https://github.com/Coolthulhu","followers_url":"https://api.github.com/users/Coolthulhu/followers","following_url":"https://api.github.com/users/Coolthulhu/following{/other_user}","gists_url":"https://api.github.com/users/Coolthulhu/gists{/gist_id}","starred_url":"https://api.github.com/users/Coolthulhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coolthulhu/subscriptions","organizations_url":"https://api.github.com/users/Coolthulhu/orgs","repos_url":"https://api.github.com/users/Coolthulhu/repos","events_url":"https://api.github.com/users/Coolthulhu/events{/privacy}","received_events_url":"https://api.github.com/users/Coolthulhu/received_events","type":"User","site_admin":false},"labels":[{"id":43873304,"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/labels/Crash","name":"Crash","color":"000000","default":false}],"state":"closed","locked":false,"assignee":{"login":"mugling","id":12238606,"avatar_url":"https://avatars.githubusercontent.com/u/12238606?v=3","gravatar_id":"","url":"https://api.github.com/users/mugling","html_url":"https://github.com/mugling","followers_url":"https://api.github.com/users/mugling/followers","following_url":"https://api.github.com/users/mugling/following{/other_user}","gists_url":"https://api.github.com/users/mugling/gists{/gist_id}","starred_url":"https://api.github.com/users/mugling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mugling/subscriptions","organizations_url":"https://api.github.com/users/mugling/orgs","repos_url":"https://api.github.com/users/mugling/repos","events_url":"https://api.github.com/users/mugling/events{/privacy}","received_events_url":"https://api.github.com/users/mugling/received_events","type":"User","site_admin":false},"assignees":[{"login":"mugling","id":12238606,"avatar_url":"https://avatars.githubusercontent.com/u/12238606?v=3","gravatar_id":"","url":"https://api.github.com/users/mugling","html_url":"https://github.com/mugling","followers_url":"https://api.github.com/users/mugling/followers","following_url":"https://api.github.com/users/mugling/following{/other_user}","gists_url":"https://api.github.com/users/mugling/gists{/gist_id}","starred_url":"https://api.github.com/users/mugling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mugling/subscriptions","organizations_url":"https://api.github.com/users/mugling/orgs","repos_url":"https://api.github.com/users/mugling/repos","events_url":"https://api.github.com/users/mugling/events{/privacy}","received_events_url":"https://api.github.com/users/mugling/received_events","type":"User","site_admin":false}],"milestone":null,"comments":39,"created_at":"2016-11-30T20:23:27Z","updated_at":"2016-12-07T12:22:33Z","closed_at":"2016-12-03T22:31:25Z","body":"Introduced in #19058\r\n\r\nThat pointer indirection wasn't needless after all.\r\n\r\nHard to replicate due to high dependency on system, compiler and possibly runtime, but can be reproduced like:\r\n* Start game\r\n* Create some items (preferably of different types)\r\n* Create new item types (artifacts)\r\n* `m_templates` is scrambled to keep the tree structure\r\n* Items' pointers to their `itype`s now point at undefined locations\r\n* Crash - or worse\r\n\r\nFixing this would require reverting #19058 or getting rid of artifacts and prohibiting future runtime types.\r\nRuntime types would be a good thing to have and artifacts - while rare - are still an important part of the game."},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/265433974","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/issues/19566#issuecomment-265433974","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19566","id":265433974,"user":{"login":"mutability","id":3055062,"avatar_url":"https://avatars.githubusercontent.com/u/3055062?v=3","gravatar_id":"","url":"https://api.github.com/users/mutability","html_url":"https://github.com/mutability","followers_url":"https://api.github.com/users/mutability/followers","following_url":"https://api.github.com/users/mutability/following{/other_user}","gists_url":"https://api.github.com/users/mutability/gists{/gist_id}","starred_url":"https://api.github.com/users/mutability/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mutability/subscriptions","organizations_url":"https://api.github.com/users/mutability/orgs","repos_url":"https://api.github.com/users/mutability/repos","events_url":"https://api.github.com/users/mutability/events{/privacy}","received_events_url":"https://api.github.com/users/mutability/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T12:22:33Z","updated_at":"2016-12-07T12:22:33Z","body":"Good point re references not being invalidated. I wonder what the original\nproblem really was here.\n\nI thought references got invalidated when unordered_map was mutated, but\nlooking more closely it's actually only iterators. So we might get away\nwith just one map.\n\nI think something similar to \"frozen\" (under another name) is still useful\nto catch cases where code is trying to work with itemtypes before they are\nready to be used (e.g. as autopickup was), even if we end up with just one\nmap.\n"}}
{"actor":{"display_login":"mutability"}}