{"action":"created","issue":{"url":"https://api.github.com/repos/Wargus/stargus/issues/33","labels_url":"https://api.github.com/repos/Wargus/stargus/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/Wargus/stargus/issues/33/comments","events_url":"https://api.github.com/repos/Wargus/stargus/issues/33/events","html_url":"https://github.com/Wargus/stargus/issues/33","id":117851132,"number":33,"title":"stargus 2.2.5.5 not compiling on on OpenBSD 5.0 GENERIC.MP#59 i386 - patches included","user":{"login":"timfel","id":46235,"avatar_url":"https://avatars.githubusercontent.com/u/46235?v=3","gravatar_id":"","url":"https://api.github.com/users/timfel","html_url":"https://github.com/timfel","followers_url":"https://api.github.com/users/timfel/followers","following_url":"https://api.github.com/users/timfel/following{/other_user}","gists_url":"https://api.github.com/users/timfel/gists{/gist_id}","starred_url":"https://api.github.com/users/timfel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timfel/subscriptions","organizations_url":"https://api.github.com/users/timfel/orgs","repos_url":"https://api.github.com/users/timfel/repos","events_url":"https://api.github.com/users/timfel/events{/privacy}","received_events_url":"https://api.github.com/users/timfel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Wargus/stargus/labels/Fix%20Released","name":"Fix Released","color":"ddffdd"},{"url":"https://api.github.com/repos/Wargus/stargus/labels/High","name":"High","color":"ffdddd"},{"url":"https://api.github.com/repos/Wargus/stargus/labels/patch","name":"patch","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-19T16:28:12Z","updated_at":"2015-11-19T16:30:11Z","closed_at":null,"body":"-patch files attached\n\n-stargus 2.2.5.5 not compiling - compile options need to be updated in Makefile\n\n-zlib header file needs to be included\n\n-removed need to worry about letter case for list files\n\n-huffmann decompression segfaulting - bug fix uses modified code from stormlib; original stormlib code was also segfaulting; original macro code PTR_VALID, PTR_INVALID, PTR_INVALID_OR_NULL assume all addresses are above 0x80000000 or all are below; segfaults when addresses are above and below 0x80000000; only need to check for two invalid addresses - updated macro code\n\n-libpng code needs to be upgraded to 1.5.4"},"comment":{"url":"https://api.github.com/repos/Wargus/stargus/issues/comments/158109697","html_url":"https://github.com/Wargus/stargus/issues/33#issuecomment-158109697","issue_url":"https://api.github.com/repos/Wargus/stargus/issues/33","id":158109697,"user":{"login":"timfel","id":46235,"avatar_url":"https://avatars.githubusercontent.com/u/46235?v=3","gravatar_id":"","url":"https://api.github.com/users/timfel","html_url":"https://github.com/timfel","followers_url":"https://api.github.com/users/timfel/followers","following_url":"https://api.github.com/users/timfel/following{/other_user}","gists_url":"https://api.github.com/users/timfel/gists{/gist_id}","starred_url":"https://api.github.com/users/timfel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timfel/subscriptions","organizations_url":"https://api.github.com/users/timfel/orgs","repos_url":"https://api.github.com/users/timfel/repos","events_url":"https://api.github.com/users/timfel/events{/privacy}","received_events_url":"https://api.github.com/users/timfel/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T16:30:11Z","updated_at":"2015-11-19T16:30:11Z","body":"(by emtneutrino)\nThis is an email I sent to the creator of StormLib explaining why I had so many segfaults on my machine using its Huffmann source code.  The huff.cpp and huff.h files I submitted to this project are still correct.\n\nSubject: Re: Re[2]: patches for huffmann decompression routines in StormLib\nFrom: electronmuontau neutrino\nTo: Ladislav Zezula\n\nI was mistaken about the reason behind my machine segfaulting frequently when using the original version 2.01 of the Huffmann source code from StormLib.  The real reason my machine would segfault so often is because mul is declared static.  It is initially set to +1 and is never set to +1 anywhere else.  The THuffmannTree constructor sets mul to -1 when \"this\" < 0, but it never sets mul to +1 when \"this\" > 0.  Once mul is set to -1, it ALWAYS stays -1 even if a new instance of \"this\" > 0.  In the case where mul = -1 and \"this\" > 0, the PTR_VALID macro will be wrong about an invalid address and lead to a segfault.  The same is true for PTR_INVALID and PTR_INVALID_OR_NULL.  If it is guaranteed that ALL valid addresses will have one sign, and ALL invalid addresses will have the opposite sign, the THuffmannTree constructor should set mul to +1 when \"this\" > 0 and set mul to -1 when \"this\" < 0.  There is no way to guarantee this, however.  This DOES NOT WORK when valid addresses have a mixture of POSITIVE AND NEGATIVE signs.  In this case, it is impossible to determine a valid address from an invalid address.\n\nHere is an example where PTR_VALID fails and causes a segfault:\n\n#define PTR_NOT(ptr)    (THTreeItem *)(~(DWORD_PTR)(ptr))\n#define PTR_VALID(ptr)    (((LONG_PTR) (ptr) * mul > 0)\n\naddress of \"this\" = 0x8000182A = -2147477462 <---- Assume this is a valid address.  Its sign is negative, therefore mul = -1\naddress of pFirst = 0x7FFFE7D6 = 2147477462 <---- Assume this is a valid address.  Its sign is positive\n\nPTR_NOT(pFirst) = 0x80001829 = -2147477463 <---- This should be an invalid address since pFirst is valid\n\nWhen any code uses the PTR_VALID macro for pFirst and PTR_NOT(pFirst) with the addresses above,\nPTR_VALID(pFirst) = 0 <---- This means that pFirst is invalid which is not true\nPTR_VALID((PTR_NOT(pFirst)) = 1 <---- This means that PTR_NOT(pFirst) is valid which is also not true and will lead to a segfault\n\nNote that 0x7FFFE7D6 + 0x00003054 = 0x8000182A in this case.\n\nMy patches DON'T depend on the sign of any addresses.  The version of the files huff.cpp and huff.h that I created patches for is 2.01 at http://zezula.net/en/mpq/download.html#StormLib.\n\nI hope this clears up any confusion.\nNeil\n"}}