Closed sbnmrk closed 9 years ago
Happy to receive your pull request with a fix
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?
Do you have a concrete example that I could use to build a unit test? I'm thinking that there should be a way to properly decode Latin1-strings too.
@sbnmrk Please respond.
Sorry, no I don't have a test case for you. I tested and verified with a certificate of someone else and I don't want to see that certificate checked in as a unit test on github.com. It contains personal information.
Maybe one can create a certificate containing non-UTF-8 characters with openssl without specifying the -utf8 switch? Don't have the time to check that. Sorry.
@sbnmrk well, like it is implemented now all such strings are ignored. You are welcome to add a proper implementation when you have time. I'm going to release DTFoundation 1.7.5 as is.
See the case for
DTASN1*String
tags in DTASN1Parser.m_parseValueWithTag:dataRange:
.The
NSString
object is always created withNSUTF8StringEncoding
. If the buffer contains invalid UTF-8 data (for instance an ISO8859 string with a special character >0x7F
), there is noNSString
object created andnil
returned. There is no check for thatnil
value, which ultimately is added into anNSArray
, crashing the application. Moreover the buffer memory is leaking according to the Apple documentation.