{"action":"created","issue":{"url":"https://api.github.com/repos/madler/zlib/issues/119","labels_url":"https://api.github.com/repos/madler/zlib/issues/119/labels{/name}","comments_url":"https://api.github.com/repos/madler/zlib/issues/119/comments","events_url":"https://api.github.com/repos/madler/zlib/issues/119/events","html_url":"https://github.com/madler/zlib/pull/119","id":121764914,"number":119,"title":"setting lseek seems to be broken on reading extrafield","user":{"login":"tschoening","id":6223655,"avatar_url":"https://avatars.githubusercontent.com/u/6223655?v=3","gravatar_id":"","url":"https://api.github.com/users/tschoening","html_url":"https://github.com/tschoening","followers_url":"https://api.github.com/users/tschoening/followers","following_url":"https://api.github.com/users/tschoening/following{/other_user}","gists_url":"https://api.github.com/users/tschoening/gists{/gist_id}","starred_url":"https://api.github.com/users/tschoening/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschoening/subscriptions","organizations_url":"https://api.github.com/users/tschoening/orgs","repos_url":"https://api.github.com/users/tschoening/repos","events_url":"https://api.github.com/users/tschoening/events{/privacy}","received_events_url":"https://api.github.com/users/tschoening/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-11T18:27:49Z","updated_at":"2015-12-11T19:21:20Z","closed_at":"2015-12-11T19:21:20Z","pull_request":{"url":"https://api.github.com/repos/madler/zlib/pulls/119","html_url":"https://github.com/madler/zlib/pull/119","diff_url":"https://github.com/madler/zlib/pull/119.diff","patch_url":"https://github.com/madler/zlib/pull/119.patch"},"body":"lseek is set differently depending on if extrafield was read or not. If it was read because some buffer for its content was provided, lseek was set to a value depending on the size of size_file_extra and the read bytes for the extra field. If no buffer was provided and extrafield was not read, lseek is always advanced for the amount of size_file_extra alone.\r\n\r\nThe problem arises afterwards, when lseek is decremented again: In this case it is assumed that it has been always advanced for size_file_extra bytes, which is not the case if extrafield was read completely before. In such a scenario it may be that lseek was not advanced at all, in which case reducing lseek from 0 to something lower than 0 breaks.\r\n\r\nAdditionally, I formatted the code a bit more readable, because I had trouble understanding how it works."},"comment":{"url":"https://api.github.com/repos/madler/zlib/issues/comments/164025168","html_url":"https://github.com/madler/zlib/pull/119#issuecomment-164025168","issue_url":"https://api.github.com/repos/madler/zlib/issues/119","id":164025168,"user":{"login":"tschoening","id":6223655,"avatar_url":"https://avatars.githubusercontent.com/u/6223655?v=3","gravatar_id":"","url":"https://api.github.com/users/tschoening","html_url":"https://github.com/tschoening","followers_url":"https://api.github.com/users/tschoening/followers","following_url":"https://api.github.com/users/tschoening/following{/other_user}","gists_url":"https://api.github.com/users/tschoening/gists{/gist_id}","starred_url":"https://api.github.com/users/tschoening/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschoening/subscriptions","organizations_url":"https://api.github.com/users/tschoening/orgs","repos_url":"https://api.github.com/users/tschoening/repos","events_url":"https://api.github.com/users/tschoening/events{/privacy}","received_events_url":"https://api.github.com/users/tschoening/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T19:21:20Z","updated_at":"2015-12-11T19:21:20Z","body":"I'll close this, didn't see it before, but minizip already has its own repo which seems to have this fix included already and is far more up to date than the version provided with zlib. So everyone running into the same problems, shoudl consider using the newer fork instead of patching on its own.\r\n\r\nhttps://github.com/nmoinvaz/minizip/commit/e42c1f8594e43db694bea46e0a66e33d605eeb09"}}