{"action":"opened","number":159,"pull_request":{"url":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/159","id":129417993,"html_url":"https://github.com/mirage/ocaml-cstruct/pull/159","diff_url":"https://github.com/mirage/ocaml-cstruct/pull/159.diff","patch_url":"https://github.com/mirage/ocaml-cstruct/pull/159.patch","issue_url":"https://api.github.com/repos/mirage/ocaml-cstruct/issues/159","number":159,"state":"open","locked":false,"title":"Fix an arithmetic overflow bug (lenv, copyv)","user":{"login":"yallop","id":1736496,"avatar_url":"https://avatars0.githubusercontent.com/u/1736496?v=3","gravatar_id":"","url":"https://api.github.com/users/yallop","html_url":"https://github.com/yallop","followers_url":"https://api.github.com/users/yallop/followers","following_url":"https://api.github.com/users/yallop/following{/other_user}","gists_url":"https://api.github.com/users/yallop/gists{/gist_id}","starred_url":"https://api.github.com/users/yallop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yallop/subscriptions","organizations_url":"https://api.github.com/users/yallop/orgs","repos_url":"https://api.github.com/users/yallop/repos","events_url":"https://api.github.com/users/yallop/events{/privacy}","received_events_url":"https://api.github.com/users/yallop/received_events","type":"User","site_admin":false},"body":"Modular arithmetic strikes again.\r\n\r\nHere's a demonstration on a 32-bit system.\r\n\r\nBefore:\r\n\r\n```ocaml\r\n# let b = Cstruct.create max_int and c = Cstruct.create 3 ;;\r\nval b : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 1073741823}\r\nval c : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 3}\r\n# Cstruct.lenv [b; b; c];;\r\n- : int = 1\r\n# Cstruct.copyv [b; b; c];;\r\nSegmentation fault\r\n```\r\n\r\nAfter:\r\n\r\n```ocaml\r\n# let b = Cstruct.create max_int and c = Cstruct.create 3 ;;\r\nval b : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 1073741823}\r\nval c : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 3}\r\n# Cstruct.lenv [b; b; c];;\r\nException: Invalid_argument \"Cstruct.lenv\".\r\n# Cstruct.copyv [b; b; c];;\r\nException: Invalid_argument \"Cstruct.copyv\".\r\n```","created_at":"2017-07-07T14:33:01Z","updated_at":"2017-07-07T14:33:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/159/commits","review_comments_url":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/159/comments","review_comment_url":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mirage/ocaml-cstruct/issues/159/comments","statuses_url":"https://api.github.com/repos/mirage/ocaml-cstruct/statuses/d21c99cccb6150dfaa531b6c0151b34c63e2d452","head":{"label":"yallop:lenv-overflow","ref":"lenv-overflow","sha":"d21c99cccb6150dfaa531b6c0151b34c63e2d452","user":{"login":"yallop","id":1736496,"avatar_url":"https://avatars0.githubusercontent.com/u/1736496?v=3","gravatar_id":"","url":"https://api.github.com/users/yallop","html_url":"https://github.com/yallop","followers_url":"https://api.github.com/users/yallop/followers","following_url":"https://api.github.com/users/yallop/following{/other_user}","gists_url":"https://api.github.com/users/yallop/gists{/gist_id}","starred_url":"https://api.github.com/users/yallop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yallop/subscriptions","organizations_url":"https://api.github.com/users/yallop/orgs","repos_url":"https://api.github.com/users/yallop/repos","events_url":"https://api.github.com/users/yallop/events{/privacy}","received_events_url":"https://api.github.com/users/yallop/received_events","type":"User","site_admin":false},"repo":{"id":11109525,"name":"ocaml-cstruct","full_name":"yallop/ocaml-cstruct","owner":{"login":"yallop","id":1736496,"avatar_url":"https://avatars0.githubusercontent.com/u/1736496?v=3","gravatar_id":"","url":"https://api.github.com/users/yallop","html_url":"https://github.com/yallop","followers_url":"https://api.github.com/users/yallop/followers","following_url":"https://api.github.com/users/yallop/following{/other_user}","gists_url":"https://api.github.com/users/yallop/gists{/gist_id}","starred_url":"https://api.github.com/users/yallop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yallop/subscriptions","organizations_url":"https://api.github.com/users/yallop/orgs","repos_url":"https://api.github.com/users/yallop/repos","events_url":"https://api.github.com/users/yallop/events{/privacy}","received_events_url":"https://api.github.com/users/yallop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yallop/ocaml-cstruct","description":"Map OCaml arrays onto C-like structs","fork":true,"url":"https://api.github.com/repos/yallop/ocaml-cstruct","forks_url":"https://api.github.com/repos/yallop/ocaml-cstruct/forks","keys_url":"https://api.github.com/repos/yallop/ocaml-cstruct/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yallop/ocaml-cstruct/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yallop/ocaml-cstruct/teams","hooks_url":"https://api.github.com/repos/yallop/ocaml-cstruct/hooks","issue_events_url":"https://api.github.com/repos/yallop/ocaml-cstruct/issues/events{/number}","events_url":"https://api.github.com/repos/yallop/ocaml-cstruct/events","assignees_url":"https://api.github.com/repos/yallop/ocaml-cstruct/assignees{/user}","branches_url":"https://api.github.com/repos/yallop/ocaml-cstruct/branches{/branch}","tags_url":"https://api.github.com/repos/yallop/ocaml-cstruct/tags","blobs_url":"https://api.github.com/repos/yallop/ocaml-cstruct/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yallop/ocaml-cstruct/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yallop/ocaml-cstruct/git/refs{/sha}","trees_url":"https://api.github.com/repos/yallop/ocaml-cstruct/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yallop/ocaml-cstruct/statuses/{sha}","languages_url":"https://api.github.com/repos/yallop/ocaml-cstruct/languages","stargazers_url":"https://api.github.com/repos/yallop/ocaml-cstruct/stargazers","contributors_url":"https://api.github.com/repos/yallop/ocaml-cstruct/contributors","subscribers_url":"https://api.github.com/repos/yallop/ocaml-cstruct/subscribers","subscription_url":"https://api.github.com/repos/yallop/ocaml-cstruct/subscription","commits_url":"https://api.github.com/repos/yallop/ocaml-cstruct/commits{/sha}","git_commits_url":"https://api.github.com/repos/yallop/ocaml-cstruct/git/commits{/sha}","comments_url":"https://api.github.com/repos/yallop/ocaml-cstruct/comments{/number}","issue_comment_url":"https://api.github.com/repos/yallop/ocaml-cstruct/issues/comments{/number}","contents_url":"https://api.github.com/repos/yallop/ocaml-cstruct/contents/{+path}","compare_url":"https://api.github.com/repos/yallop/ocaml-cstruct/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yallop/ocaml-cstruct/merges","archive_url":"https://api.github.com/repos/yallop/ocaml-cstruct/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yallop/ocaml-cstruct/downloads","issues_url":"https://api.github.com/repos/yallop/ocaml-cstruct/issues{/number}","pulls_url":"https://api.github.com/repos/yallop/ocaml-cstruct/pulls{/number}","milestones_url":"https://api.github.com/repos/yallop/ocaml-cstruct/milestones{/number}","notifications_url":"https://api.github.com/repos/yallop/ocaml-cstruct/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yallop/ocaml-cstruct/labels{/name}","releases_url":"https://api.github.com/repos/yallop/ocaml-cstruct/releases{/id}","deployments_url":"https://api.github.com/repos/yallop/ocaml-cstruct/deployments","created_at":"2013-07-01T23:00:06Z","updated_at":"2014-04-19T19:11:51Z","pushed_at":"2017-07-07T14:31:12Z","git_url":"git://github.com/yallop/ocaml-cstruct.git","ssh_url":"git@github.com:yallop/ocaml-cstruct.git","clone_url":"https://github.com/yallop/ocaml-cstruct.git","svn_url":"https://github.com/yallop/ocaml-cstruct","homepage":null,"size":906,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mirage:master","ref":"master","sha":"3c119b33316fca54bd1db73e54f43608f0bfdace","user":{"login":"mirage","id":131943,"avatar_url":"https://avatars0.githubusercontent.com/u/131943?v=3","gravatar_id":"","url":"https://api.github.com/users/mirage","html_url":"https://github.com/mirage","followers_url":"https://api.github.com/users/mirage/followers","following_url":"https://api.github.com/users/mirage/following{/other_user}","gists_url":"https://api.github.com/users/mirage/gists{/gist_id}","starred_url":"https://api.github.com/users/mirage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirage/subscriptions","organizations_url":"https://api.github.com/users/mirage/orgs","repos_url":"https://api.github.com/users/mirage/repos","events_url":"https://api.github.com/users/mirage/events{/privacy}","received_events_url":"https://api.github.com/users/mirage/received_events","type":"Organization","site_admin":false},"repo":{"id":4266022,"name":"ocaml-cstruct","full_name":"mirage/ocaml-cstruct","owner":{"login":"mirage","id":131943,"avatar_url":"https://avatars0.githubusercontent.com/u/131943?v=3","gravatar_id":"","url":"https://api.github.com/users/mirage","html_url":"https://github.com/mirage","followers_url":"https://api.github.com/users/mirage/followers","following_url":"https://api.github.com/users/mirage/following{/other_user}","gists_url":"https://api.github.com/users/mirage/gists{/gist_id}","starred_url":"https://api.github.com/users/mirage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirage/subscriptions","organizations_url":"https://api.github.com/users/mirage/orgs","repos_url":"https://api.github.com/users/mirage/repos","events_url":"https://api.github.com/users/mirage/events{/privacy}","received_events_url":"https://api.github.com/users/mirage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mirage/ocaml-cstruct","description":"Map OCaml arrays onto C-like structs","fork":false,"url":"https://api.github.com/repos/mirage/ocaml-cstruct","forks_url":"https://api.github.com/repos/mirage/ocaml-cstruct/forks","keys_url":"https://api.github.com/repos/mirage/ocaml-cstruct/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mirage/ocaml-cstruct/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mirage/ocaml-cstruct/teams","hooks_url":"https://api.github.com/repos/mirage/ocaml-cstruct/hooks","issue_events_url":"https://api.github.com/repos/mirage/ocaml-cstruct/issues/events{/number}","events_url":"https://api.github.com/repos/mirage/ocaml-cstruct/events","assignees_url":"https://api.github.com/repos/mirage/ocaml-cstruct/assignees{/user}","branches_url":"https://api.github.com/repos/mirage/ocaml-cstruct/branches{/branch}","tags_url":"https://api.github.com/repos/mirage/ocaml-cstruct/tags","blobs_url":"https://api.github.com/repos/mirage/ocaml-cstruct/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mirage/ocaml-cstruct/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mirage/ocaml-cstruct/git/refs{/sha}","trees_url":"https://api.github.com/repos/mirage/ocaml-cstruct/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mirage/ocaml-cstruct/statuses/{sha}","languages_url":"https://api.github.com/repos/mirage/ocaml-cstruct/languages","stargazers_url":"https://api.github.com/repos/mirage/ocaml-cstruct/stargazers","contributors_url":"https://api.github.com/repos/mirage/ocaml-cstruct/contributors","subscribers_url":"https://api.github.com/repos/mirage/ocaml-cstruct/subscribers","subscription_url":"https://api.github.com/repos/mirage/ocaml-cstruct/subscription","commits_url":"https://api.github.com/repos/mirage/ocaml-cstruct/commits{/sha}","git_commits_url":"https://api.github.com/repos/mirage/ocaml-cstruct/git/commits{/sha}","comments_url":"https://api.github.com/repos/mirage/ocaml-cstruct/comments{/number}","issue_comment_url":"https://api.github.com/repos/mirage/ocaml-cstruct/issues/comments{/number}","contents_url":"https://api.github.com/repos/mirage/ocaml-cstruct/contents/{+path}","compare_url":"https://api.github.com/repos/mirage/ocaml-cstruct/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mirage/ocaml-cstruct/merges","archive_url":"https://api.github.com/repos/mirage/ocaml-cstruct/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mirage/ocaml-cstruct/downloads","issues_url":"https://api.github.com/repos/mirage/ocaml-cstruct/issues{/number}","pulls_url":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls{/number}","milestones_url":"https://api.github.com/repos/mirage/ocaml-cstruct/milestones{/number}","notifications_url":"https://api.github.com/repos/mirage/ocaml-cstruct/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mirage/ocaml-cstruct/labels{/name}","releases_url":"https://api.github.com/repos/mirage/ocaml-cstruct/releases{/id}","deployments_url":"https://api.github.com/repos/mirage/ocaml-cstruct/deployments","created_at":"2012-05-08T22:11:25Z","updated_at":"2017-06-01T11:14:55Z","pushed_at":"2017-07-07T13:45:02Z","git_url":"git://github.com/mirage/ocaml-cstruct.git","ssh_url":"git@github.com:mirage/ocaml-cstruct.git","clone_url":"https://github.com/mirage/ocaml-cstruct.git","svn_url":"https://github.com/mirage/ocaml-cstruct","homepage":null,"size":1290,"stargazers_count":44,"watchers_count":44,"language":"OCaml","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":20,"forks":33,"open_issues":20,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/159"},"html":{"href":"https://github.com/mirage/ocaml-cstruct/pull/159"},"issue":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/issues/159"},"comments":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/issues/159/comments"},"review_comments":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/159/comments"},"review_comment":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/pulls/159/commits"},"statuses":{"href":"https://api.github.com/repos/mirage/ocaml-cstruct/statuses/d21c99cccb6150dfaa531b6c0151b34c63e2d452"}},"merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":40,"deletions":8,"changed_files":3}}
{"actor":{"display_login":"yallop"}}