Skip to content

Aside tag parsing crashes when creating a text rangeΒ #231

@mcichecki

Description

@mcichecki

I don't have a text to reproduce this issue but it seems like it's crashing for one of our users. We've been using the markdown library for almost a year now and it's the first time we noticed issue with it.

Thread #6: lowerBound
EXC_BREAKPOINT

+0xce56b4 SourceLocation. (Aside.swift:234)
+0xce56b4 Comparable. (<compiler-generated>:15)
+0xce56b4 Comparable. (<compiler-generated>)
+0xce56b4 closure in BlockQuote.parseAsideTag (Aside.swift:234)
+0xce4ff4 Optional.map<T> (RawMarkup.swift)
+0xce4ff4 BlockQuote.parseAsideTag (Aside.swift:231)
+0xce5734 Aside.init (Aside.swift:183)
+0xcaae7c AIBlock.init (AIBlock.swift:18) <- the last call from our code

AIBlock init:

public init?(blockQuote: BlockQuote?) {
    guard let blockQuote else { return nil }
    let aside = Aside(blockQuote)
    guard aside.isAI else { return nil }
    self.aside = aside
}

Looks like this line is causing a problem:

return newStart..<originalRange.upperBound

Is it related to these changes that were released in 0.6.0 version? #196

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions