Uploaded image for project: 'Swift'
  1. Swift
  2. SR-7112

TestJSONSerialization crash with [NSNull(), NSNull(), NSNull()]

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Foundation
    • Labels:
      None
    • Environment:

      OS: macOS 10.13.3

      swift-corelibs-foundation: b41506ce7918f4b5eff7374045dc319c896db8af

      Toolchain: swift-DEVELOPMENT-SNAPSHOT-2018-03-02-a-osx.pkg

      Xcode: 9.2

      Description

      TestJSONSerialization crash with a test case of [NSNull(), NSNull(), NSNull()], contained in

      test_serialize_null() of TestFoundation.

       

      Stacktrace:

      • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x604799545000)

          frame #0: 0x0000000101a0e032 SwiftFoundation`__CFStringEncodeByteStream(string=class name = _TtC15SwiftFoundation8NSString, rangeLoc=0, rangeLen=0, generatingExternalFile=false, encoding=134217984, lossByte='\0', buffer=0x0000000000000000, max=0, usedBufLen=0x00007ffeefbfbc50) at CFStringEncodings.c:639

          frame #1: 0x0000000101514f66 SwiftFoundation`NSString.lengthOfBytes(enc=4, self=0x0000604799546fd0) at NSString.swift:912

          frame #2: 0x000000010177ae8e SwiftFoundation`StringProtocol<>.lengthOfBytes(encoding=<unavailable>, self="[null,null,null]") at NSStringAPI.swift:854

          frame #3: 0x00000001014eda59 SwiftFoundation`static JSONSerialization._data(value=3 values, opt=(rawValue = 0), stream=false, self=SwiftFoundation.JSONSerialization) at JSONSerialization.swift:155

          frame #4: 0x00000001014f058e SwiftFoundation`static JSONSerialization.data(value=3 values, opt=(rawValue = 0), self=SwiftFoundation.JSONSerialization) at JSONSerialization.swift:166

          frame #5: 0x000000010010a930 TestFoundation`TestJSONSerialization.trySerialize(obj=3 values, options=(rawValue = 0), self=0x0000604012b4bfb0) at TestJSONSerialization.swift:995

        * frame #6: 0x000000010010e3af TestFoundation`implicit closure #5 in TestJSONSerialization.test_serialize_null(self=0x0000604012b4bfb0, arr2=3 values) at TestJSONSerialization.swift:1110

          frame #7: 0x000000010011aa4b TestFoundation`partial apply for implicit closure #5 in TestJSONSerialization.test_serialize_null() at <compiler-generated>:0

          frame #8: 0x000000010000ba5a TestFoundation`thunk for @callee_guaranteed () -> (@owned String, @error @owned Error) at <compiler-generated>:0

          frame #9: 0x000000010011aa9b TestFoundation`thunk for @callee_guaranteed () -> (@owned String, @error @owned Error)partial apply at <compiler-generated>:0

          frame #10: 0x000000010256b1d3 SwiftXCTest`closure #1 in XCTAssertEqual<A>(expression1=0x000000010011aa80 TestFoundation`reabstraction thunk helper from @callee_guaranteed () -> (@owned Swift.String, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out Swift.String, @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".951" at <compiler-generated>, expression2=0x000000010011aad0 TestFoundation`reabstraction thunk helper from @callee_guaranteed () -> (@owned Swift.String, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out Swift.String, @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".955" at <compiler-generated>) at XCTAssert.swift:163

          frame #11: 0x000000010256f89d SwiftXCTest`partial apply for closure #1 in XCTAssertEqual<A>(::_:file:line:) at <compiler-generated>:0

          frame #12: 0x000000010256a7f9 SwiftXCTest`XCTEvaluateAssertion(assertion=equal, message=0x000000010000fa60 TestFoundation`implicit closure #1 : @autoclosure () -> Swift.String in default argument 2 of SwiftXCTest.XCTAssertEqual<A where A: Swift.Equatable>(: @autoclosure () throws -> A, : @autoclosure () throws -> A, _: @autoclosure () -> Swift.String, file: Swift.StaticString, line: Swift.UInt) -> () at <compiler-generated>, file="/Users/ohara/swift-source/swift-corelibs-foundation/TestFoundation/TestJSONSerialization.swift", line=1110, expression=0x000000010256f860 SwiftXCTest`partial apply forwarder for closure #1 () throws -> SwiftXCTest.(_XCTAssertionResult in _CD6CD0A2DBFBA5169682DE15F782621E) in SwiftXCTest.XCTAssertEqual<A where A: Swift.Equatable>(: @autoclosure () throws -> A, _: @autoclosure () throws -> A, _: @autoclosure () -> Swift.String, file: Swift.StaticString, line: Swift.UInt) -> () at <compiler-generated>) at XCTAssert.swift:83

          frame #13: 0x000000010256b0f5 SwiftXCTest`XCTAssertEqual<A>(expression1=0x000000010011aa80 TestFoundation`reabstraction thunk helper from @callee_guaranteed () -> (@owned Swift.String, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out Swift.String, @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".951" at <compiler-generated>, expression2=0x000000010011aad0 TestFoundation`reabstraction thunk helper from @callee_guaranteed () -> (@owned Swift.String, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out Swift.String, @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".955" at <compiler-generated>, message=0x000000010000fa60 TestFoundation`implicit closure #1 : @autoclosure () -> Swift.String in default argument 2 of SwiftXCTest.XCTAssertEqual<A where A: Swift.Equatable>(_: @autoclosure () throws -> A, _: @autoclosure () throws -> A, _: @autoclosure () -> Swift.String, file: Swift.StaticString, line: Swift.UInt) -> () at <compiler-generated>, file="/Users/ohara/swift-source/swift-corelibs-foundation/TestFoundation/TestJSONSerialization.swift", line=1110) at XCTAssert.swift:162

          frame #14: 0x00000001000f5472 TestFoundation`TestJSONSerialization.test_serialize_null(self=0x0000604012b4bfb0) at TestJSONSerialization.swift:1110

          frame #15: 0x0000000100122289 TestFoundation`partial apply for TestJSONSerialization.test_serialize_null() at <compiler-generated>:0

          frame #16: 0x00000001000025e6 TestFoundation`thunk for @escaping @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0

          frame #17: 0x000000010012261b TestFoundation`partial apply for thunk for @escaping @callee_guaranteed () -> (@error @owned Error) at <compiler-generated>:0

          frame #18: 0x000000010255cb54 SwiftXCTest`thunk for @escaping @callee_guaranteed (@in ()) -> (@out (), @error @owned Error) at <compiler-generated>:0

          frame #19: 0x000000010255db9b SwiftXCTest`partial apply for thunk for @escaping @callee_guaranteed (@in ()) -> (@out (), @error @owned Error) at <compiler-generated>:0

          frame #20: 0x000000010255d2e3 SwiftXCTest`closure #1 in test<A>(testCaseType=0x0000604012b4bfb0, testFunc=0x000000010255daa0 SwiftXCTest`partial apply forwarder for reabstraction thunk helper <A where A: SwiftXCTest.XCTestCase> from @escaping @callee_guaranteed (@in A) -> (@out @escaping @callee_guaranteed (@in ()) -> (@out (), @error @owned Swift.Error)) to @escaping @callee_guaranteed (@owned A) -> (@owned @escaping @callee_guaranteed () -> (@error @owned Swift.Error)) at <compiler-generated>) at XCTestCase.swift:169

          frame #21: 0x000000010255da56 SwiftXCTest`partial apply for closure #1 in test<A>(_ at <compiler-generated>:0

          frame #22: 0x000000010255cbb9 SwiftXCTest`thunk for @escaping @callee_guaranteed (@owned XCTestCase) -> (@error @owned Error) at <compiler-generated>:0

          frame #23: 0x000000010255db2b SwiftXCTest`thunk for @escaping @callee_guaranteed (@owned XCTestCase) -> (@error @owned Error)partial apply at <compiler-generated>:0

          frame #24: 0x0000000102565cd1 SwiftXCTest`thunk for @escaping @callee_guaranteed (@in XCTestCase) -> (@out (), @error @owned Error) at <compiler-generated>:0

          frame #25: 0x00000001025693db SwiftXCTest`partial apply for thunk for @escaping @callee_guaranteed (@in XCTestCase) -> (@out (), @error @owned Error) at <compiler-generated>:0

          frame #26: 0x000000010255bd25 SwiftXCTest`XCTestCase.invokeTest(self=0x0000604012b4bfb0) at XCTestCase.swift:86

          frame #27: 0x000000010255b696 SwiftXCTest`XCTestCase.perform(run=0x00006047993b4fb0, self=0x0000604012b4bfb0) at XCTestCase.swift:66

          frame #28: 0x000000010255ecb6 SwiftXCTest`XCTest.run(self=0x0000604012b4bfb0) at XCAbstractTest.swift:52

          frame #29: 0x00000001025683c8 SwiftXCTest`XCTestSuite.perform(run=0x00006047919dcfa0, self=0x00006040124d9fc0) at XCTestSuite.swift:49

          frame #30: 0x000000010255ecb6 SwiftXCTest`XCTest.run(self=0x00006040124d9fc0) at XCAbstractTest.swift:52

          frame #31: 0x00000001025683c8 SwiftXCTest`XCTestSuite.perform(run=0x000060401ac16fa0, self=0x000060400ce8dfd0) at XCTestSuite.swift:49

          frame #32: 0x000000010255ecb6 SwiftXCTest`XCTest.run(self=0x000060400ce8dfd0) at XCAbstractTest.swift:52

          frame #33: 0x00000001025683c8 SwiftXCTest`XCTestSuite.perform(run=0x00006040181fbfa0, self=0x000060400ce6ffd0) at XCTestSuite.swift:49

          frame #34: 0x000000010255ecb6 SwiftXCTest`XCTest.run(self=0x000060400ce6ffd0) at XCAbstractTest.swift:52

          frame #35: 0x00000001025518bf SwiftXCTest`XCTMain(testCases=82 values) at XCTestMain.swift:96

          frame #36: 0x000000010055a861 TestFoundation`main at main.swift:29

          frame #37: 0x00007fff7b503115 libdyld.dylib`start + 1

          frame #38: 0x00007fff7b503115 libdyld.dylib`start + 1

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yamoridon Kazuki Ohara
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: