AztecEditor-iOS icon indicating copy to clipboard operation
AztecEditor-iOS copied to clipboard

Prevent crash due to malformed data.

Open Roger-Blinto opened this issue 2 years ago • 3 comments

Happened in the wild when pasting bullet list copied from the very same view.

Roger-Blinto avatar Jun 22 '23 07:06 Roger-Blinto

unarchiveTopLevelObjectWithData was deprecated in iOS 12.0

suggest code

do {
    let attributedString = try NSKeyedUnarchiver.unarchivedObject(ofClass: NSAttributedString.self, from: data)
    return attributedString
} catch {
    debugPrint(error.localizedDescription)
    return nil
}

spongemook avatar Jul 05 '23 07:07 spongemook

@spongemook Sure, that is more future proof. I would have preferred it as a one-liner, as the original. The library is for iOS 11 and onwards. If that version is increased there will be one less thing to change. Not counting this commit, 12 other API:s deprecated in iOS 15 or earlier are being used. Considering the number of issues, non merged pull requests and recent commit frequency I would say the repository is close to being abandoned...

Roger-Blinto avatar Jul 07 '23 12:07 Roger-Blinto

Hi @Roger-Blinto – sorry about the wait on this – we'd be happy to merge it, but it'd be really helpful to see a test case to go along with it that demonstrates the issue.

jkmassel avatar Nov 04 '23 02:11 jkmassel

Fixed in a similar way in the master. Not included in latest release yet.

Roger-Blinto avatar May 02 '24 12:05 Roger-Blinto