{"action":"created","issue":{"url":"https://api.github.com/repos/bwapi/bwapi/issues/571","labels_url":"https://api.github.com/repos/bwapi/bwapi/issues/571/labels{/name}","comments_url":"https://api.github.com/repos/bwapi/bwapi/issues/571/comments","events_url":"https://api.github.com/repos/bwapi/bwapi/issues/571/events","html_url":"https://github.com/bwapi/bwapi/issues/571","id":66010010,"number":571,"title":"Unit id > 1700 ?","user":{"login":"ufsqufbqifbqibfuiq","id":11097519,"avatar_url":"https://avatars.githubusercontent.com/u/11097519?v=3","gravatar_id":"","url":"https://api.github.com/users/ufsqufbqifbqibfuiq","html_url":"https://github.com/ufsqufbqifbqibfuiq","followers_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/followers","following_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/following{/other_user}","gists_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/gists{/gist_id}","starred_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/subscriptions","organizations_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/orgs","repos_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/repos","events_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/events{/privacy}","received_events_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bwapi/bwapi/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/bwapi/bwapi/labels/Priority-Critical","name":"Priority-Critical","color":"FFFFFF"},{"url":"https://api.github.com/repos/bwapi/bwapi/labels/regression","name":"regression","color":"b04000"}],"state":"open","locked":false,"assignee":{"login":"heinermann","id":1966366,"avatar_url":"https://avatars.githubusercontent.com/u/1966366?v=3","gravatar_id":"","url":"https://api.github.com/users/heinermann","html_url":"https://github.com/heinermann","followers_url":"https://api.github.com/users/heinermann/followers","following_url":"https://api.github.com/users/heinermann/following{/other_user}","gists_url":"https://api.github.com/users/heinermann/gists{/gist_id}","starred_url":"https://api.github.com/users/heinermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heinermann/subscriptions","organizations_url":"https://api.github.com/users/heinermann/orgs","repos_url":"https://api.github.com/users/heinermann/repos","events_url":"https://api.github.com/users/heinermann/events{/privacy}","received_events_url":"https://api.github.com/users/heinermann/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/bwapi/bwapi/milestones/2","html_url":"https://github.com/bwapi/bwapi/milestones/4.1.1","labels_url":"https://api.github.com/repos/bwapi/bwapi/milestones/2/labels","id":959632,"number":2,"title":"4.1.1","description":"This milestone should contain bug fixes and general improvements for 4.1.0.\r\nThe changes may be cherry picked to the 4.1.0 branch.\r\n\r\n","creator":{"login":"heinermann","id":1966366,"avatar_url":"https://avatars.githubusercontent.com/u/1966366?v=3","gravatar_id":"","url":"https://api.github.com/users/heinermann","html_url":"https://github.com/heinermann","followers_url":"https://api.github.com/users/heinermann/followers","following_url":"https://api.github.com/users/heinermann/following{/other_user}","gists_url":"https://api.github.com/users/heinermann/gists{/gist_id}","starred_url":"https://api.github.com/users/heinermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heinermann/subscriptions","organizations_url":"https://api.github.com/users/heinermann/orgs","repos_url":"https://api.github.com/users/heinermann/repos","events_url":"https://api.github.com/users/heinermann/events{/privacy}","received_events_url":"https://api.github.com/users/heinermann/received_events","type":"User","site_admin":false},"open_issues":29,"closed_issues":9,"state":"open","created_at":"2015-01-31T19:18:36Z","updated_at":"2015-04-03T00:54:26Z","due_on":"2015-02-28T05:00:00Z","closed_at":null},"comments":3,"created_at":"2015-04-02T20:55:56Z","updated_at":"2015-04-03T01:58:54Z","closed_at":null,"body":"I've got some crashes (read \"security failure\") in BWAPI::Templates::iterateUnitFinder.\r\n\r\nThe CRT reports that \"A buffer overrun has occurred in AIModuleLoader.exe which has corrupted the program's internal state\". \r\n\r\nIt is due to the stack security cookie being overwriten during the execution of BWAPI::Templates::iterateUnitFinder. Just before the function return, __security_check_cookie is called and it raises this error.\r\n\r\nIt occurs when the game has run for a long time, with a lot of units created (currently my bot only know how to spam marines), and playing vs 2 zerg computers.\r\n\r\nBy setting a memory write breakpoint on the cookie, I've caught the following:\r\n\r\n    //dwFinderFlags[iUnitIndex] = 0; BWAPIClient\\Source\\GameImpl.cpp, line 148\r\n    mov         dword ptr [esp+ebx*4+50h],0              // ebx = 1703\r\n\r\ndwFinderFlags is a stack array of 1701 elements allocated by BWAPI::Templates::iterateUnitFinder.\r\n\r\nI though that BWAPI assumed that units ID can never be > 1700, but it seems that here iUnitIndex is equal to 1703, erasing the cookie.\r\n\r\nWhat is going on ?\r\n\r\nEdit:\r\n\r\nFrom the post game screen, the computers created 508 + 309 units, and my bot 747.\r\nThis is a total of 1564 units created, not far from 1700...\r\n"},"comment":{"url":"https://api.github.com/repos/bwapi/bwapi/issues/comments/89118800","html_url":"https://github.com/bwapi/bwapi/issues/571#issuecomment-89118800","issue_url":"https://api.github.com/repos/bwapi/bwapi/issues/571","id":89118800,"user":{"login":"ufsqufbqifbqibfuiq","id":11097519,"avatar_url":"https://avatars.githubusercontent.com/u/11097519?v=3","gravatar_id":"","url":"https://api.github.com/users/ufsqufbqifbqibfuiq","html_url":"https://github.com/ufsqufbqifbqibfuiq","followers_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/followers","following_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/following{/other_user}","gists_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/gists{/gist_id}","starred_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/subscriptions","organizations_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/orgs","repos_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/repos","events_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/events{/privacy}","received_events_url":"https://api.github.com/users/ufsqufbqifbqibfuiq/received_events","type":"User","site_admin":false},"created_at":"2015-04-03T01:58:54Z","updated_at":"2015-04-03T01:58:54Z","body":"Thanks for your answer.\n\nA simple workaround would be to increase all units array[1700] to... i don’t know, maybe 5000 is definitely enough, as 1700 was almost never a problem before. \n\nThe memory usage would probably still be ok, for “nowaday” computers.\n\nAs a repro, I could send you the replays. I also have full dumps of starcraft.exe and moduleLoader.exe (few hundreds Mo though).\nOr I could send you my bot dll so you could let it play. On maps like Luna the final it happens 25% of the games, that is when my bot don’t die.\n\nFrom: Adam Heinermann \nSent: Friday, April 03, 2015 3:35 AM\nTo: bwapi/bwapi \nCc: github newbie \nSubject: Re: [bwapi] Unit id > 1700 ? (#571)\n\nDefinitely a bug, since ID is always expected to be less than 1700. I'm not sure why that array is size 1701 when it should be size 1700.\nAdded the assert but I don't think it will help much since we still need to figure out why it's getting ids >= 1700.\n\nI actually don't know what is happening or why, I've never seen this as an issue before. The client is really messed up. The idea that this is inconsistent means that the logic behind all of this is wrong. I don't have a test case to repro it so I'm not sure how to go about it.\n\n—\nReply to this email directly or view it on GitHub.\n"}}