{"action":"closed","number":366,"pull_request":{"url":"https://api.github.com/repos/plusvic/yara/pulls/366","id":49549062,"html_url":"https://github.com/plusvic/yara/pull/366","diff_url":"https://github.com/plusvic/yara/pull/366.diff","patch_url":"https://github.com/plusvic/yara/pull/366.patch","issue_url":"https://api.github.com/repos/plusvic/yara/issues/366","number":366,"state":"closed","locked":false,"title":"Properly handle negative serial numbers.","user":{"login":"wxsBSD","id":1394879,"avatar_url":"https://avatars.githubusercontent.com/u/1394879?v=3","gravatar_id":"","url":"https://api.github.com/users/wxsBSD","html_url":"https://github.com/wxsBSD","followers_url":"https://api.github.com/users/wxsBSD/followers","following_url":"https://api.github.com/users/wxsBSD/following{/other_user}","gists_url":"https://api.github.com/users/wxsBSD/gists{/gist_id}","starred_url":"https://api.github.com/users/wxsBSD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wxsBSD/subscriptions","organizations_url":"https://api.github.com/users/wxsBSD/orgs","repos_url":"https://api.github.com/users/wxsBSD/repos","events_url":"https://api.github.com/users/wxsBSD/events{/privacy}","received_events_url":"https://api.github.com/users/wxsBSD/received_events","type":"User","site_admin":false},"body":"Negative serial numbers are stored in an ASN1_INTEGER using two's\r\ncomplement. This meant that negative serials were not properly handled\r\nprior to this commit.\r\n\r\nTo fix this always use i2c_ASN1_INTEGER() to convert a serial number to\r\nit's \"character\" representation. You have to call i2c_ASN1_INTEGER()\r\ntwice. The first call needs to be with a NULL second argument, which\r\nwill return the number of bytes needed to store the serial, you can then\r\nallocate a buffer and call i2c_ASN1_INTEGER() a second time to get the\r\nproperly formatted serial number.\r\n\r\nIn the interest of making the code easier to read I chose to do this\r\neven for positive ASN1_INTEGER structures.\r\n\r\nNegative serial numbers are against the RFC but they do exist. For\r\nexample 4bfe05f182aa273e113db6ed7dae4bb8.","created_at":"2015-11-03T12:23:58Z","updated_at":"2015-12-01T11:37:50Z","closed_at":"2015-12-01T11:37:50Z","merged_at":"2015-12-01T11:37:50Z","merge_commit_sha":"b3c1725f95f21be32bf09c1a52e2225d44e8835c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/plusvic/yara/pulls/366/commits","review_comments_url":"https://api.github.com/repos/plusvic/yara/pulls/366/comments","review_comment_url":"https://api.github.com/repos/plusvic/yara/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plusvic/yara/issues/366/comments","statuses_url":"https://api.github.com/repos/plusvic/yara/statuses/be4b068905aea3186d80cc40440b5c12e97fada6","head":{"label":"wxsBSD:negative_serials","ref":"negative_serials","sha":"be4b068905aea3186d80cc40440b5c12e97fada6","user":{"login":"wxsBSD","id":1394879,"avatar_url":"https://avatars.githubusercontent.com/u/1394879?v=3","gravatar_id":"","url":"https://api.github.com/users/wxsBSD","html_url":"https://github.com/wxsBSD","followers_url":"https://api.github.com/users/wxsBSD/followers","following_url":"https://api.github.com/users/wxsBSD/following{/other_user}","gists_url":"https://api.github.com/users/wxsBSD/gists{/gist_id}","starred_url":"https://api.github.com/users/wxsBSD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wxsBSD/subscriptions","organizations_url":"https://api.github.com/users/wxsBSD/orgs","repos_url":"https://api.github.com/users/wxsBSD/repos","events_url":"https://api.github.com/users/wxsBSD/events{/privacy}","received_events_url":"https://api.github.com/users/wxsBSD/received_events","type":"User","site_admin":false},"repo":{"id":23631201,"name":"yara","full_name":"wxsBSD/yara","owner":{"login":"wxsBSD","id":1394879,"avatar_url":"https://avatars.githubusercontent.com/u/1394879?v=3","gravatar_id":"","url":"https://api.github.com/users/wxsBSD","html_url":"https://github.com/wxsBSD","followers_url":"https://api.github.com/users/wxsBSD/followers","following_url":"https://api.github.com/users/wxsBSD/following{/other_user}","gists_url":"https://api.github.com/users/wxsBSD/gists{/gist_id}","starred_url":"https://api.github.com/users/wxsBSD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wxsBSD/subscriptions","organizations_url":"https://api.github.com/users/wxsBSD/orgs","repos_url":"https://api.github.com/users/wxsBSD/repos","events_url":"https://api.github.com/users/wxsBSD/events{/privacy}","received_events_url":"https://api.github.com/users/wxsBSD/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wxsBSD/yara","description":"A malware identification tool","fork":true,"url":"https://api.github.com/repos/wxsBSD/yara","forks_url":"https://api.github.com/repos/wxsBSD/yara/forks","keys_url":"https://api.github.com/repos/wxsBSD/yara/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wxsBSD/yara/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wxsBSD/yara/teams","hooks_url":"https://api.github.com/repos/wxsBSD/yara/hooks","issue_events_url":"https://api.github.com/repos/wxsBSD/yara/issues/events{/number}","events_url":"https://api.github.com/repos/wxsBSD/yara/events","assignees_url":"https://api.github.com/repos/wxsBSD/yara/assignees{/user}","branches_url":"https://api.github.com/repos/wxsBSD/yara/branches{/branch}","tags_url":"https://api.github.com/repos/wxsBSD/yara/tags","blobs_url":"https://api.github.com/repos/wxsBSD/yara/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wxsBSD/yara/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wxsBSD/yara/git/refs{/sha}","trees_url":"https://api.github.com/repos/wxsBSD/yara/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wxsBSD/yara/statuses/{sha}","languages_url":"https://api.github.com/repos/wxsBSD/yara/languages","stargazers_url":"https://api.github.com/repos/wxsBSD/yara/stargazers","contributors_url":"https://api.github.com/repos/wxsBSD/yara/contributors","subscribers_url":"https://api.github.com/repos/wxsBSD/yara/subscribers","subscription_url":"https://api.github.com/repos/wxsBSD/yara/subscription","commits_url":"https://api.github.com/repos/wxsBSD/yara/commits{/sha}","git_commits_url":"https://api.github.com/repos/wxsBSD/yara/git/commits{/sha}","comments_url":"https://api.github.com/repos/wxsBSD/yara/comments{/number}","issue_comment_url":"https://api.github.com/repos/wxsBSD/yara/issues/comments{/number}","contents_url":"https://api.github.com/repos/wxsBSD/yara/contents/{+path}","compare_url":"https://api.github.com/repos/wxsBSD/yara/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wxsBSD/yara/merges","archive_url":"https://api.github.com/repos/wxsBSD/yara/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wxsBSD/yara/downloads","issues_url":"https://api.github.com/repos/wxsBSD/yara/issues{/number}","pulls_url":"https://api.github.com/repos/wxsBSD/yara/pulls{/number}","milestones_url":"https://api.github.com/repos/wxsBSD/yara/milestones{/number}","notifications_url":"https://api.github.com/repos/wxsBSD/yara/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wxsBSD/yara/labels{/name}","releases_url":"https://api.github.com/repos/wxsBSD/yara/releases{/id}","created_at":"2014-09-03T17:58:17Z","updated_at":"2015-11-24T01:59:53Z","pushed_at":"2015-11-22T21:15:54Z","git_url":"git://github.com/wxsBSD/yara.git","ssh_url":"git@github.com:wxsBSD/yara.git","clone_url":"https://github.com/wxsBSD/yara.git","svn_url":"https://github.com/wxsBSD/yara","homepage":"http://plusvic.github.io/yara/","size":14849,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"plusvic:master","ref":"master","sha":"2fac34b744813465ed39c19452289401f5430e69","user":{"login":"plusvic","id":182937,"avatar_url":"https://avatars.githubusercontent.com/u/182937?v=3","gravatar_id":"","url":"https://api.github.com/users/plusvic","html_url":"https://github.com/plusvic","followers_url":"https://api.github.com/users/plusvic/followers","following_url":"https://api.github.com/users/plusvic/following{/other_user}","gists_url":"https://api.github.com/users/plusvic/gists{/gist_id}","starred_url":"https://api.github.com/users/plusvic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plusvic/subscriptions","organizations_url":"https://api.github.com/users/plusvic/orgs","repos_url":"https://api.github.com/users/plusvic/repos","events_url":"https://api.github.com/users/plusvic/events{/privacy}","received_events_url":"https://api.github.com/users/plusvic/received_events","type":"User","site_admin":false},"repo":{"id":7037996,"name":"yara","full_name":"plusvic/yara","owner":{"login":"plusvic","id":182937,"avatar_url":"https://avatars.githubusercontent.com/u/182937?v=3","gravatar_id":"","url":"https://api.github.com/users/plusvic","html_url":"https://github.com/plusvic","followers_url":"https://api.github.com/users/plusvic/followers","following_url":"https://api.github.com/users/plusvic/following{/other_user}","gists_url":"https://api.github.com/users/plusvic/gists{/gist_id}","starred_url":"https://api.github.com/users/plusvic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plusvic/subscriptions","organizations_url":"https://api.github.com/users/plusvic/orgs","repos_url":"https://api.github.com/users/plusvic/repos","events_url":"https://api.github.com/users/plusvic/events{/privacy}","received_events_url":"https://api.github.com/users/plusvic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/plusvic/yara","description":"The pattern matching swiss knife","fork":false,"url":"https://api.github.com/repos/plusvic/yara","forks_url":"https://api.github.com/repos/plusvic/yara/forks","keys_url":"https://api.github.com/repos/plusvic/yara/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plusvic/yara/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plusvic/yara/teams","hooks_url":"https://api.github.com/repos/plusvic/yara/hooks","issue_events_url":"https://api.github.com/repos/plusvic/yara/issues/events{/number}","events_url":"https://api.github.com/repos/plusvic/yara/events","assignees_url":"https://api.github.com/repos/plusvic/yara/assignees{/user}","branches_url":"https://api.github.com/repos/plusvic/yara/branches{/branch}","tags_url":"https://api.github.com/repos/plusvic/yara/tags","blobs_url":"https://api.github.com/repos/plusvic/yara/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plusvic/yara/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plusvic/yara/git/refs{/sha}","trees_url":"https://api.github.com/repos/plusvic/yara/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plusvic/yara/statuses/{sha}","languages_url":"https://api.github.com/repos/plusvic/yara/languages","stargazers_url":"https://api.github.com/repos/plusvic/yara/stargazers","contributors_url":"https://api.github.com/repos/plusvic/yara/contributors","subscribers_url":"https://api.github.com/repos/plusvic/yara/subscribers","subscription_url":"https://api.github.com/repos/plusvic/yara/subscription","commits_url":"https://api.github.com/repos/plusvic/yara/commits{/sha}","git_commits_url":"https://api.github.com/repos/plusvic/yara/git/commits{/sha}","comments_url":"https://api.github.com/repos/plusvic/yara/comments{/number}","issue_comment_url":"https://api.github.com/repos/plusvic/yara/issues/comments{/number}","contents_url":"https://api.github.com/repos/plusvic/yara/contents/{+path}","compare_url":"https://api.github.com/repos/plusvic/yara/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plusvic/yara/merges","archive_url":"https://api.github.com/repos/plusvic/yara/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plusvic/yara/downloads","issues_url":"https://api.github.com/repos/plusvic/yara/issues{/number}","pulls_url":"https://api.github.com/repos/plusvic/yara/pulls{/number}","milestones_url":"https://api.github.com/repos/plusvic/yara/milestones{/number}","notifications_url":"https://api.github.com/repos/plusvic/yara/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plusvic/yara/labels{/name}","releases_url":"https://api.github.com/repos/plusvic/yara/releases{/id}","created_at":"2012-12-06T15:33:08Z","updated_at":"2015-11-30T02:50:30Z","pushed_at":"2015-12-01T11:37:50Z","git_url":"git://github.com/plusvic/yara.git","ssh_url":"git@github.com:plusvic/yara.git","clone_url":"https://github.com/plusvic/yara.git","svn_url":"https://github.com/plusvic/yara","homepage":"http://plusvic.github.io/yara/","size":22452,"stargazers_count":730,"watchers_count":730,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":178,"mirror_url":null,"open_issues_count":52,"forks":178,"open_issues":52,"watchers":730,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plusvic/yara/pulls/366"},"html":{"href":"https://github.com/plusvic/yara/pull/366"},"issue":{"href":"https://api.github.com/repos/plusvic/yara/issues/366"},"comments":{"href":"https://api.github.com/repos/plusvic/yara/issues/366/comments"},"review_comments":{"href":"https://api.github.com/repos/plusvic/yara/pulls/366/comments"},"review_comment":{"href":"https://api.github.com/repos/plusvic/yara/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plusvic/yara/pulls/366/commits"},"statuses":{"href":"https://api.github.com/repos/plusvic/yara/statuses/be4b068905aea3186d80cc40440b5c12e97fada6"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"plusvic","id":182937,"avatar_url":"https://avatars.githubusercontent.com/u/182937?v=3","gravatar_id":"","url":"https://api.github.com/users/plusvic","html_url":"https://github.com/plusvic","followers_url":"https://api.github.com/users/plusvic/followers","following_url":"https://api.github.com/users/plusvic/following{/other_user}","gists_url":"https://api.github.com/users/plusvic/gists{/gist_id}","starred_url":"https://api.github.com/users/plusvic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plusvic/subscriptions","organizations_url":"https://api.github.com/users/plusvic/orgs","repos_url":"https://api.github.com/users/plusvic/repos","events_url":"https://api.github.com/users/plusvic/events{/privacy}","received_events_url":"https://api.github.com/users/plusvic/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":61,"deletions":26,"changed_files":1}}