{"action":"created","issue":{"url":"https://api.github.com/repos/regular/unbzip2-stream/issues/7","repository_url":"https://api.github.com/repos/regular/unbzip2-stream","labels_url":"https://api.github.com/repos/regular/unbzip2-stream/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/regular/unbzip2-stream/issues/7/comments","events_url":"https://api.github.com/repos/regular/unbzip2-stream/issues/7/events","html_url":"https://github.com/regular/unbzip2-stream/issues/7","id":156304198,"number":7,"title":"TypeError: Cannot read property '0' of undefined","user":{"login":"jviotti","id":2192773,"avatar_url":"https://avatars.githubusercontent.com/u/2192773?v=3","gravatar_id":"","url":"https://api.github.com/users/jviotti","html_url":"https://github.com/jviotti","followers_url":"https://api.github.com/users/jviotti/followers","following_url":"https://api.github.com/users/jviotti/following{/other_user}","gists_url":"https://api.github.com/users/jviotti/gists{/gist_id}","starred_url":"https://api.github.com/users/jviotti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jviotti/subscriptions","organizations_url":"https://api.github.com/users/jviotti/orgs","repos_url":"https://api.github.com/users/jviotti/repos","events_url":"https://api.github.com/users/jviotti/events{/privacy}","received_events_url":"https://api.github.com/users/jviotti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-05-23T15:34:58Z","updated_at":"2016-08-25T20:02:15Z","closed_at":null,"body":"I get the following error when attempting to decompress various bzip2 files:\r\n\r\n```\r\nTypeError: Cannot read property '0' of undefined\r\n    at f (/Users/jviotti/Projects/resin/etcher/node_modules/unbzip2-stream/lib/bit_iterator.js:24:34)\r\n    at Object.bzip2.decompress (/Users/jviotti/Projects/resin/etcher/node_modules/unbzip2-stream/lib/bzip2.js:272:13)\r\n    at decompressBlock (/Users/jviotti/Projects/resin/etcher/node_modules/unbzip2-stream/index.js:29:28)\r\n    at decompressAndQueue (/Users/jviotti/Projects/resin/etcher/node_modules/unbzip2-stream/index.js:46:20)\r\n    at Stream.write (/Users/jviotti/Projects/resin/etcher/node_modules/unbzip2-stream/index.js:75:36)\r\n    at Stream.stream.write (/Users/jviotti/Projects/resin/etcher/node_modules/through/index.js:26:11)\r\n    at Through2.ondata (_stream_readable.js:536:20)\r\n    at emitOne (events.js:90:13)\r\n    at Through2.emit (events.js:182:7)\r\n    at readableAddChunk (_stream_readable.js:153:18)\r\n    at Through2.Readable.push (_stream_readable.js:111:10)\r\n    at Through2.Transform.push (_stream_transform.js:128:32)\r\n    at afterTransform (_stream_transform.js:77:12)\r\n    at TransformState.afterTransform (_stream_transform.js:54:12)\r\n    at Through2.write [as _transform] (/Users/jviotti/Projects/resin/etcher/node_modules/progress-stream/index.js:46:3)\r\n    at Through2.Transform._read (_stream_transform.js:167:10)\r\n    at Through2.Transform._write (_stream_transform.js:155:12)\r\n    at doWrite (_stream_writable.js:301:12)\r\n    at writeOrBuffer (_stream_writable.js:287:5)\r\n    at Through2.Writable.write (_stream_writable.js:215:11)\r\n    at ReadStream.ondata (_stream_readable.js:536:20)\r\n    at emitOne (events.js:90:13)\r\n    at ReadStream.emit (events.js:182:7)\r\n    at readableAddChunk (_stream_readable.js:153:18)\r\n    at ReadStream.Readable.push (_stream_readable.js:111:10)\r\n    at onread (fs.js:1818:12)\r\n    at FSReqWrap.wrapper [as oncomplete] (fs.js:614:17)\r\n```\r\n\r\nThe issue seems to come from the bit iterator. I was able to reproduce with virtually every bzip2 file I created, at least on OS X."},"comment":{"url":"https://api.github.com/repos/regular/unbzip2-stream/issues/comments/242517593","html_url":"https://github.com/regular/unbzip2-stream/issues/7#issuecomment-242517593","issue_url":"https://api.github.com/repos/regular/unbzip2-stream/issues/7","id":242517593,"user":{"login":"jeromew","id":687842,"avatar_url":"https://avatars.githubusercontent.com/u/687842?v=3","gravatar_id":"","url":"https://api.github.com/users/jeromew","html_url":"https://github.com/jeromew","followers_url":"https://api.github.com/users/jeromew/followers","following_url":"https://api.github.com/users/jeromew/following{/other_user}","gists_url":"https://api.github.com/users/jeromew/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromew/subscriptions","organizations_url":"https://api.github.com/users/jeromew/orgs","repos_url":"https://api.github.com/users/jeromew/repos","events_url":"https://api.github.com/users/jeromew/events{/privacy}","received_events_url":"https://api.github.com/users/jeromew/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T20:02:15Z","updated_at":"2016-08-25T20:02:15Z","body":"I encountered the same issue with unbzip2-stream before finding this issue. \r\nI hit the issue or not on the same file depending on what seem random facts (I am streaming direcly from the network). Can the bug depend on the size of the chunks that through writes ?\r\n\r\nI could not really understand how unbzip2 stops reading bits when the network is not fast enough to fill the parsing frontier. Could it be the problem ?"}}
{"actor":{"display_login":"jeromew"}}