{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/19215","labels_url":"https://api.github.com/repos/akka/akka/issues/19215/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/19215/comments","events_url":"https://api.github.com/repos/akka/akka/issues/19215/events","html_url":"https://github.com/akka/akka/issues/19215","id":122711208,"number":19215,"title":"Sink.inputStream OutOfBoundsException","user":{"login":"drewhk","id":932285,"avatar_url":"https://avatars.githubusercontent.com/u/932285?v=3","gravatar_id":"","url":"https://api.github.com/users/drewhk","html_url":"https://github.com/drewhk","followers_url":"https://api.github.com/users/drewhk/followers","following_url":"https://api.github.com/users/drewhk/following{/other_user}","gists_url":"https://api.github.com/users/drewhk/gists{/gist_id}","starred_url":"https://api.github.com/users/drewhk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewhk/subscriptions","organizations_url":"https://api.github.com/users/drewhk/orgs","repos_url":"https://api.github.com/users/drewhk/repos","events_url":"https://api.github.com/users/drewhk/events{/privacy}","received_events_url":"https://api.github.com/users/drewhk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/akka/akka/labels/1%20-%20triaged","name":"1 - triaged","color":"5319e7"},{"url":"https://api.github.com/repos/akka/akka/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/akka/akka/labels/t:io","name":"t:io","color":"ededed"},{"url":"https://api.github.com/repos/akka/akka/labels/t:stream","name":"t:stream","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/akka/akka/milestones/16","html_url":"https://github.com/akka/akka/milestones/streams-2.0","labels_url":"https://api.github.com/repos/akka/akka/milestones/16/labels","id":745106,"number":16,"title":"streams-2.0","description":"","creator":{"login":"rkuhn","id":470469,"avatar_url":"https://avatars.githubusercontent.com/u/470469?v=3","gravatar_id":"","url":"https://api.github.com/users/rkuhn","html_url":"https://github.com/rkuhn","followers_url":"https://api.github.com/users/rkuhn/followers","following_url":"https://api.github.com/users/rkuhn/following{/other_user}","gists_url":"https://api.github.com/users/rkuhn/gists{/gist_id}","starred_url":"https://api.github.com/users/rkuhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkuhn/subscriptions","organizations_url":"https://api.github.com/users/rkuhn/orgs","repos_url":"https://api.github.com/users/rkuhn/repos","events_url":"https://api.github.com/users/rkuhn/events{/privacy}","received_events_url":"https://api.github.com/users/rkuhn/received_events","type":"User","site_admin":false},"open_issues":49,"closed_issues":24,"state":"open","created_at":"2014-08-06T15:08:47Z","updated_at":"2015-12-17T15:14:22Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-12-17T10:53:05Z","updated_at":"2015-12-18T05:46:50Z","closed_at":null,"body":"Inside `getData`:\r\n\r\n```\r\n        val size = data.size - skipBytes\r\n        if (size + gotBytes <= length) {\r\n          System.arraycopy(data.toArray, skipBytes, arr, begin, size)\r\n          skipBytes = 0\r\n          detachedChunk = None\r\n          if (length - size == 0)\r\n            gotBytes + size\r\n          else\r\n            getData(arr, begin + size, length - size, gotBytes + size)\r\n        } else {\r\n          System.arraycopy(data.toArray, skipBytes, arr, begin, length) \r\n          skipBytes = length\r\n          gotBytes + length\r\n        }\r\n```\r\n\r\nThe first arraycopy is wrong, since it tries to copy `size` bytes which can be larger than the `length` clients requested. ping @agolubev"},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/165679364","html_url":"https://github.com/akka/akka/issues/19215#issuecomment-165679364","issue_url":"https://api.github.com/repos/akka/akka/issues/19215","id":165679364,"user":{"login":"agolubev","id":461456,"avatar_url":"https://avatars.githubusercontent.com/u/461456?v=3","gravatar_id":"","url":"https://api.github.com/users/agolubev","html_url":"https://github.com/agolubev","followers_url":"https://api.github.com/users/agolubev/followers","following_url":"https://api.github.com/users/agolubev/following{/other_user}","gists_url":"https://api.github.com/users/agolubev/gists{/gist_id}","starred_url":"https://api.github.com/users/agolubev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agolubev/subscriptions","organizations_url":"https://api.github.com/users/agolubev/orgs","repos_url":"https://api.github.com/users/agolubev/repos","events_url":"https://api.github.com/users/agolubev/events{/privacy}","received_events_url":"https://api.github.com/users/agolubev/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T05:46:50Z","updated_at":"2015-12-18T05:46:50Z","body":"found two other bugs but non of them relates to first arraycopy directly"}}