Skip to content

DDXMLNode crash (compactXMLString -> XMLStringWithOptions) #105

@vladimirkolbas

Description

@vladimirkolbas

We're seing a crash that isn't manually reproducible, but does occur somewhat frequently reported by Fabric (so guessing it's easier to trigger in release mode with optimizations).

File involved is DDXMLNode.m, line 1187:

CFStringTrimWhitespace((__bridge CFMutableStringRef)xmlString);
crashing with

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000

We believe it's occuring when sending an initial presence to the stream

xmppStream.send(XMPPPresence())

We're guessing the allocated XMPPresence goes out of scope and in some cases accessing the pointer will lead to accessing the deallocated memory.

We've just tried assigning the sent presence to a local variable to keep it alive for a longer time to see if that will solve the problem, but will need more time to see if the number of crashes decreases or drops to zero.

We believe the sent stanza is similar to this one, looks valid:

<presence><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://github.com/robbiehanson/XMPPFramework" ver="HmCrMVXR466Cmi5/TS/7FP+cYrE="></c><x xmlns="vcard-temp:x:update"><photo>f4c1fc071a8a13571cf32cdc3fd52a606544495e</photo></x></presence>

Do you have any better suggenstions how to evade this crash?

Screenshot of the log from Fabric attached below:

screen shot 2018-06-26 at 10 44 54

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions