{"action":"created","issue":{"url":"https://api.github.com/repos/Cocoanetics/DTFoundation/issues/90","labels_url":"https://api.github.com/repos/Cocoanetics/DTFoundation/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/Cocoanetics/DTFoundation/issues/90/comments","events_url":"https://api.github.com/repos/Cocoanetics/DTFoundation/issues/90/events","html_url":"https://github.com/Cocoanetics/DTFoundation/issues/90","id":57454558,"number":90,"title":"crash parsing ASN.1 string with non-UTF-8 coded special character","user":{"login":"sbnmrk","id":10975612,"avatar_url":"https://avatars.githubusercontent.com/u/10975612?v=3","gravatar_id":"","url":"https://api.github.com/users/sbnmrk","html_url":"https://github.com/sbnmrk","followers_url":"https://api.github.com/users/sbnmrk/followers","following_url":"https://api.github.com/users/sbnmrk/following{/other_user}","gists_url":"https://api.github.com/users/sbnmrk/gists{/gist_id}","starred_url":"https://api.github.com/users/sbnmrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbnmrk/subscriptions","organizations_url":"https://api.github.com/users/sbnmrk/orgs","repos_url":"https://api.github.com/users/sbnmrk/repos","events_url":"https://api.github.com/users/sbnmrk/events{/privacy}","received_events_url":"https://api.github.com/users/sbnmrk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-12T12:34:01Z","updated_at":"2015-02-14T07:43:38Z","closed_at":null,"body":"See the case for `DTASN1*String` tags in DTASN1Parser.m `_parseValueWithTag:dataRange:`.\r\n\r\nThe `NSString` object is always created with `NSUTF8StringEncoding`. If the buffer contains invalid UTF-8 data (for instance an ISO8859 string with a special character > `0x7F`), there is no `NSString` object created and `nil` returned. There is no check for that `nil` value, which ultimately is added into an `NSArray`, crashing the application.\r\nMoreover the buffer memory is leaking according to the [Apple documentation](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/#//apple_ref/occ/instm/NSString/initWithBytesNoCopy:length:encoding:freeWhenDone:)."},"comment":{"url":"https://api.github.com/repos/Cocoanetics/DTFoundation/issues/comments/74365873","html_url":"https://github.com/Cocoanetics/DTFoundation/issues/90#issuecomment-74365873","issue_url":"https://api.github.com/repos/Cocoanetics/DTFoundation/issues/90","id":74365873,"user":{"login":"Cocoanetics","id":333270,"avatar_url":"https://avatars.githubusercontent.com/u/333270?v=3","gravatar_id":"","url":"https://api.github.com/users/Cocoanetics","html_url":"https://github.com/Cocoanetics","followers_url":"https://api.github.com/users/Cocoanetics/followers","following_url":"https://api.github.com/users/Cocoanetics/following{/other_user}","gists_url":"https://api.github.com/users/Cocoanetics/gists{/gist_id}","starred_url":"https://api.github.com/users/Cocoanetics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cocoanetics/subscriptions","organizations_url":"https://api.github.com/users/Cocoanetics/orgs","repos_url":"https://api.github.com/users/Cocoanetics/repos","events_url":"https://api.github.com/users/Cocoanetics/events{/privacy}","received_events_url":"https://api.github.com/users/Cocoanetics/received_events","type":"User","site_admin":false},"created_at":"2015-02-14T07:43:38Z","updated_at":"2015-02-14T07:43:38Z","body":"I've returned from vacation and would like to include a proper fix for this issue. Do you have a pull request and/or a unit test for this?"}}