Skip to content

When the parsed array length is very large, it will crash and report an error: EXC_BREAKPOINT (code=1, subcode=0x1a10aa84c) #118

Open
@DanielHusx

Description

@DanielHusx

here is wrong cbor data but parse crashed.

    do {
        let bytes: [UInt8] = [
            0x9b,
            0x54, 0x68, 0x47, 0x9e, 0x98, 0x41, 0xd5, 0xed,
            0xae, 0x42, 0x4b, 0x9e, 0x68, 0x68, 0x47,
            0xa0, 0xf0, 0x41, 0xe2, 0xc4, 0x73, 0x42, 0x4f, 0x8c, 0x48, 0x68, 0x47, 0xa3, 0x48, 0x41, 0xe2,
            0x6c, 0xf2, 0x42, 0x3f, 0x1b, 0x3c, 0x68, 0x47, 0xa5, 0xa0, 0x41, 0xe1, 0xce, 0x5a, 0x42, 0x3d,
            0x71, 0x74, 0x68, 0x47, 0xa7, 0xf8, 0x41, 0xe2, 0x57, 0x12, 0x42, 0x3b, 0x54, 0x6c, 0x68, 0x47,
            0xaa, 0x50, 0x41, 0xe4, 0x17, 0x84, 0x42, 0x40, 0x6d, 0x24, 0x68, 0x47, 0xac, 0xa8, 0x41, 0xe0,
            0xa1, 0x91, 0x42, 0x41, 0xef, 0xdc, 0x68, 0x47, 0xaf, 0x0, 0x41, 0xd8, 0x93, 0xd0, 0x42, 0x48,
            0xfa, 0xa0, 0x68, 0x47, 0xb1, 0x58, 0x41, 0xd5, 0x5a, 0x5, 0x42, 0x4e, 0xfd, 0xb4, 0x68, 0x47,
            0xb3, 0xb0, 0x41, 0xd4, 0x43, 0x1c, 0x42, 0x50, 0x57, 0x6c, 0x68, 0x47, 0xb6, 0x8, 0x41, 0xd3,
            0xc5, 0x54, 0x42, 0x52, 0x37, 0xe4, 0x68, 0x47, 0xb8, 0x60, 0x41, 0xd4, 0x38, 0x2c, 0x42, 0x5f,
            0x84, 0x3c, 0x68, 0x47, 0xba, 0xb8, 0x41, 0xd3, 0x94, 0x1b, 0x42, 0x63, 0x6c, 0x40, 0x68, 0x47,
            0xbd, 0x10, 0x41, 0xd3, 0x5, 0xeb, 0x42, 0x61, 0x5e, 0xdc, 0x68, 0x47
        ]
        let ret = try CBOR.decode(bytes)
        print("解析: \(ret)")
    } catch {
        print("异常: \(error)")
    }

crash at CBORDecoder.readN method with error: EXC_BREAKPOINT (code=1, subcode=0x1a10aa84c)

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