{"action":"created","comment":{"url":"https://api.github.com/repos/bluss/rust-ndarray/pulls/comments/50816013","id":50816013,"diff_hunk":"@@ -66,12 +66,13 @@ pub fn dim_stride_overlap<D: Dimension>(dim: &D, strides: &D) -> bool\n /// to the last element of each dimension should be smaller than the length\n /// of the slice. Also, the strides should not allow a same element to be\n /// referenced by two different index.\n-pub fn can_index_slice<A, D: Dimension>(data: &[A],\n-                                        dim: &D,\n-                                        strides: &D\n-                                       ) -> Result<(), StrideError>\n+pub fn can_index_slice<A, D: Dimension>(data: &[A], dim: &D, strides: &D)\n+    -> Result<(), StrideError>\n {\n     if strides.slice().iter().cloned().all(stride_is_positive) {\n+        if dim.size_checked().is_none() || strides.size_checked().is_none() {","path":"src/dimension.rs","position":52,"original_position":52,"commit_id":"a6c2dd6f374a6f75e26ea90e3fd320c04e8236c9","original_commit_id":"a6c2dd6f374a6f75e26ea90e3fd320c04e8236c9","user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"body":"This is inside the all strides positive check.\r\n\r\nComputing the stride product seems to be very wrong; I should probably check the (dimension - 1) * stride computation for overflow instead.","created_at":"2016-01-26T10:14:02Z","updated_at":"2016-01-26T10:14:02Z","html_url":"https://github.com/bluss/rust-ndarray/pull/64#discussion_r50816013","pull_request_url":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/bluss/rust-ndarray/pulls/comments/50816013"},"html":{"href":"https://github.com/bluss/rust-ndarray/pull/64#discussion_r50816013"},"pull_request":{"href":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64","id":57154379,"html_url":"https://github.com/bluss/rust-ndarray/pull/64","diff_url":"https://github.com/bluss/rust-ndarray/pull/64.diff","patch_url":"https://github.com/bluss/rust-ndarray/pull/64.patch","issue_url":"https://api.github.com/repos/bluss/rust-ndarray/issues/64","number":64,"state":"open","locked":false,"title":"Adjustments for the stride constructors & overflow error handling","user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"body":"Follow up on PR #59 \r\n\r\n@vbarrielle I discovered another thing that must be checked generally, and that's wraparound when computing the number of elements in a shape.\r\n\r\nIt's a bit sad, requires adding error cases to all multidimensional constructors (eye, from_elem, zeros).\r\n\r\nOld code would for example allow this, amusingly (in release mode, where we don't have debug assertions for this wrap around in the multiplication)\r\n\r\n```rust\r\nlet five = OwnedArray::<f32, _>::zeros(5);\r\nlet _five_large = five.into_shape((3, 7, 29, 36760123, 823996703)).unwrap();\r\n```","created_at":"2016-01-26T00:42:44Z","updated_at":"2016-01-26T10:14:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ce064e0d8acd42dd1040b7830607d2f0ba90bcb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64/commits","review_comments_url":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64/comments","review_comment_url":"https://api.github.com/repos/bluss/rust-ndarray/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bluss/rust-ndarray/issues/64/comments","statuses_url":"https://api.github.com/repos/bluss/rust-ndarray/statuses/a6c2dd6f374a6f75e26ea90e3fd320c04e8236c9","head":{"label":"bluss:stride-mod","ref":"stride-mod","sha":"a6c2dd6f374a6f75e26ea90e3fd320c04e8236c9","user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"repo":{"id":22598813,"name":"rust-ndarray","full_name":"bluss/rust-ndarray","owner":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bluss/rust-ndarray","description":"ndarray: an N-dimensional array with array views, arbitrary slicing, and efficient operations","fork":false,"url":"https://api.github.com/repos/bluss/rust-ndarray","forks_url":"https://api.github.com/repos/bluss/rust-ndarray/forks","keys_url":"https://api.github.com/repos/bluss/rust-ndarray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluss/rust-ndarray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluss/rust-ndarray/teams","hooks_url":"https://api.github.com/repos/bluss/rust-ndarray/hooks","issue_events_url":"https://api.github.com/repos/bluss/rust-ndarray/issues/events{/number}","events_url":"https://api.github.com/repos/bluss/rust-ndarray/events","assignees_url":"https://api.github.com/repos/bluss/rust-ndarray/assignees{/user}","branches_url":"https://api.github.com/repos/bluss/rust-ndarray/branches{/branch}","tags_url":"https://api.github.com/repos/bluss/rust-ndarray/tags","blobs_url":"https://api.github.com/repos/bluss/rust-ndarray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluss/rust-ndarray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluss/rust-ndarray/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluss/rust-ndarray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluss/rust-ndarray/statuses/{sha}","languages_url":"https://api.github.com/repos/bluss/rust-ndarray/languages","stargazers_url":"https://api.github.com/repos/bluss/rust-ndarray/stargazers","contributors_url":"https://api.github.com/repos/bluss/rust-ndarray/contributors","subscribers_url":"https://api.github.com/repos/bluss/rust-ndarray/subscribers","subscription_url":"https://api.github.com/repos/bluss/rust-ndarray/subscription","commits_url":"https://api.github.com/repos/bluss/rust-ndarray/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluss/rust-ndarray/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluss/rust-ndarray/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluss/rust-ndarray/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluss/rust-ndarray/contents/{+path}","compare_url":"https://api.github.com/repos/bluss/rust-ndarray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluss/rust-ndarray/merges","archive_url":"https://api.github.com/repos/bluss/rust-ndarray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluss/rust-ndarray/downloads","issues_url":"https://api.github.com/repos/bluss/rust-ndarray/issues{/number}","pulls_url":"https://api.github.com/repos/bluss/rust-ndarray/pulls{/number}","milestones_url":"https://api.github.com/repos/bluss/rust-ndarray/milestones{/number}","notifications_url":"https://api.github.com/repos/bluss/rust-ndarray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluss/rust-ndarray/labels{/name}","releases_url":"https://api.github.com/repos/bluss/rust-ndarray/releases{/id}","deployments_url":"https://api.github.com/repos/bluss/rust-ndarray/deployments","created_at":"2014-08-04T09:27:53Z","updated_at":"2016-01-25T18:20:53Z","pushed_at":"2016-01-26T00:42:44Z","git_url":"git://github.com/bluss/rust-ndarray.git","ssh_url":"git@github.com:bluss/rust-ndarray.git","clone_url":"https://github.com/bluss/rust-ndarray.git","svn_url":"https://github.com/bluss/rust-ndarray","homepage":"https://bluss.github.io/rust-ndarray/","size":2601,"stargazers_count":60,"watchers_count":60,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":20,"forks":9,"open_issues":20,"watchers":60,"default_branch":"master"}},"base":{"label":"bluss:master","ref":"master","sha":"6d960a49c57df4bc43c0dea04c3bbd1de1789885","user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"repo":{"id":22598813,"name":"rust-ndarray","full_name":"bluss/rust-ndarray","owner":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bluss/rust-ndarray","description":"ndarray: an N-dimensional array with array views, arbitrary slicing, and efficient operations","fork":false,"url":"https://api.github.com/repos/bluss/rust-ndarray","forks_url":"https://api.github.com/repos/bluss/rust-ndarray/forks","keys_url":"https://api.github.com/repos/bluss/rust-ndarray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluss/rust-ndarray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluss/rust-ndarray/teams","hooks_url":"https://api.github.com/repos/bluss/rust-ndarray/hooks","issue_events_url":"https://api.github.com/repos/bluss/rust-ndarray/issues/events{/number}","events_url":"https://api.github.com/repos/bluss/rust-ndarray/events","assignees_url":"https://api.github.com/repos/bluss/rust-ndarray/assignees{/user}","branches_url":"https://api.github.com/repos/bluss/rust-ndarray/branches{/branch}","tags_url":"https://api.github.com/repos/bluss/rust-ndarray/tags","blobs_url":"https://api.github.com/repos/bluss/rust-ndarray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluss/rust-ndarray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluss/rust-ndarray/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluss/rust-ndarray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluss/rust-ndarray/statuses/{sha}","languages_url":"https://api.github.com/repos/bluss/rust-ndarray/languages","stargazers_url":"https://api.github.com/repos/bluss/rust-ndarray/stargazers","contributors_url":"https://api.github.com/repos/bluss/rust-ndarray/contributors","subscribers_url":"https://api.github.com/repos/bluss/rust-ndarray/subscribers","subscription_url":"https://api.github.com/repos/bluss/rust-ndarray/subscription","commits_url":"https://api.github.com/repos/bluss/rust-ndarray/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluss/rust-ndarray/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluss/rust-ndarray/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluss/rust-ndarray/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluss/rust-ndarray/contents/{+path}","compare_url":"https://api.github.com/repos/bluss/rust-ndarray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluss/rust-ndarray/merges","archive_url":"https://api.github.com/repos/bluss/rust-ndarray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluss/rust-ndarray/downloads","issues_url":"https://api.github.com/repos/bluss/rust-ndarray/issues{/number}","pulls_url":"https://api.github.com/repos/bluss/rust-ndarray/pulls{/number}","milestones_url":"https://api.github.com/repos/bluss/rust-ndarray/milestones{/number}","notifications_url":"https://api.github.com/repos/bluss/rust-ndarray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluss/rust-ndarray/labels{/name}","releases_url":"https://api.github.com/repos/bluss/rust-ndarray/releases{/id}","deployments_url":"https://api.github.com/repos/bluss/rust-ndarray/deployments","created_at":"2014-08-04T09:27:53Z","updated_at":"2016-01-25T18:20:53Z","pushed_at":"2016-01-26T00:42:44Z","git_url":"git://github.com/bluss/rust-ndarray.git","ssh_url":"git@github.com:bluss/rust-ndarray.git","clone_url":"https://github.com/bluss/rust-ndarray.git","svn_url":"https://github.com/bluss/rust-ndarray","homepage":"https://bluss.github.io/rust-ndarray/","size":2601,"stargazers_count":60,"watchers_count":60,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":20,"forks":9,"open_issues":20,"watchers":60,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64"},"html":{"href":"https://github.com/bluss/rust-ndarray/pull/64"},"issue":{"href":"https://api.github.com/repos/bluss/rust-ndarray/issues/64"},"comments":{"href":"https://api.github.com/repos/bluss/rust-ndarray/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/bluss/rust-ndarray/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bluss/rust-ndarray/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/bluss/rust-ndarray/statuses/a6c2dd6f374a6f75e26ea90e3fd320c04e8236c9"}}}}