ios - EXC_BAD_ACCESS with NSRegularExpression matchesInString: -
i have line of code in app uses regular expression find pgp keys in string of user input.
nsarray *pgpkeymatch = [pgpkeyregex matchesinstring:userinput options:0 range:nsmakerange(0, [userinput length])];
for cases works expected. i've run problem when particularly long key input (length of 334,629 instead of ~9,000). get: thread 1: exc_bad_access(code=1, address=0x8)
, app crashes.
i've tried using zombies instrument (which found nothing) , setting exception breakpoint (which didn't yield more information).
stepping through code shows nsrange created successfully, goes wrong later in execution of matchesinstring: .
does have insight on what's causing bad access? or why issue long key? below more complete excerpt of code:
nsstring *userinput = self.inputkey.text; nserror *pgpkeyregexerror = null; nsregularexpression *pgpkeyregex = [nsregularexpression regularexpressionwithpattern:@"(?:-----begin pgp (?:public|private) key block-----)\n(?:(?:.*:.*)\n)*\n(?:[^-]|\n)*\n(?:-----end pgp (?:public|private) key block-----)" options:0 error:&pgpkeyregexerror]; nsarray *pgpkeymatch = [pgpkeyregex matchesinstring:userinput options:0 range:nsmakerange(0, [userinput length])];
Comments
Post a Comment