Skip to content

Instantly share code, notes, and snippets.

@NachoSoto
Created March 28, 2017 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NachoSoto/8d991d1dec478eb0e1fc4f2b294e2cba to your computer and use it in GitHub Desktop.
Save NachoSoto/8d991d1dec478eb0e1fc4f2b294e2cba to your computer and use it in GitHub Desktop.
Test Suite 'All tests' started at 2017-03-28 11:27:46.053
Test Suite 'Quick.framework' started at 2017-03-28 11:27:46.055
Test Suite 'Quick.framework' passed at 2017-03-28 11:27:46.055.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'APITests.xctest' started at 2017-03-28 11:27:46.056
Test Suite 'WebURLParserSpec' started at 2017-03-28 11:27:46.057
Test Case '-[APITests.WebURLParserSpec Card_graph_URLs__parses_url_with_all_data]' started.
=================================================================
==32504==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600028a8b0 at pc 0x0001207f1970 bp 0x7fff529ebf30 sp 0x7fff529ebf28
WRITE of size 8 at 0x60600028a8b0 thread T0
#0 0x1207f196f in _TTSf4g_d___TFC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A451ffV10Foundation13URLComponentsGVs10DictionaryOS0_P33_F7A0FBEC69C912D6857459CF87969A459ParameterSS_ WebURLParser.swift
#1 0x1207e4064 in _TFC3API12WebURLParser8parseURLfSSGO6Result6ResultOS_6WebURLOS0_5Error_ WebURLParser.swift:47
#2 0x120574e06 in _TTSf4g___TFFFC8APITests16WebURLParserSpec4specFT_T_U_FT_T_U_FT_T_ WebURLParserSpec.swift:23
#3 0x12056c5ad in _TFFFC8APITests16WebURLParserSpec4specFT_T_U_FT_T_U_FT_T_ WebURLParserSpec.swift
#4 0x120e4f25f in _TFC5Quick7Example3runfT_T_ (Quick:x86_64+0x1625f)
#5 0x120e4f575 in _TToFC5Quick7Example3runfT_T_ (Quick:x86_64+0x16575)
#6 0x120e3b4b9 in __60+[QuickSpec addInstanceMethodForExample:classSelectorNames:]_block_invoke (Quick:x86_64+0x24b9)
#7 0x10ec0ec6b in __invoking___ (CoreFoundation:x86_64+0x79c6b)
#8 0x10ec0eb3f in -[NSInvocation invoke] (CoreFoundation:x86_64+0x79b3f)
#9 0x10e5d28e1 in __24-[XCTestCase invokeTest]_block_invoke_2 (XCTest:x86_64+0x1d8e1)
#10 0x10e610f61 in -[XCTestContext performInScope:] (XCTest:x86_64+0x5bf61)
#11 0x10e5d26e3 in -[XCTestCase invokeTest] (XCTest:x86_64+0x1d6e3)
#12 0x10e5d2fb1 in -[XCTestCase performTest:] (XCTest:x86_64+0x1dfb1)
#13 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#14 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#15 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#16 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#17 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#18 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#19 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#20 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#21 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#22 0x10e61ca85 in __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke (XCTest:x86_64+0x67a85)
#23 0x10e5def26 in -[XCTestObservationCenter _observeTestExecutionForBlock:] (XCTest:x86_64+0x29f26)
#24 0x10e61c924 in -[XCTTestRunSession runTestsAndReturnError:] (XCTest:x86_64+0x67924)
#25 0x10e5baa4f in -[XCTestDriver runTestsAndReturnError:] (XCTest:x86_64+0x5a4f)
#26 0x10e61486d in _XCTestMain (XCTest:x86_64+0x5f86d)
#27 0x10d212678 (xctest:x86_64+0x100002678)
#28 0x11025d65c in start (libdyld.dylib:x86_64+0x465c)
0x60600028a8b0 is located 16 bytes inside of 64-byte region [0x60600028a8a0,0x60600028a8e0)
freed by thread T0 here:
#0 0x10d2ec386 in wrap_free (libclang_rt.asan_iossim_dynamic.dylib:x86_64+0x51386)
#1 0x1207f0378 in _TTSf4n_n_n_d_n___TTSg5GVs12_ArrayBufferTOC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A459ParameterSS__GS_TS2_SS__s20_ArrayBufferProtocols_GVs14_IgnorePointerTS2_SS__GS4_TS2_SS__s16_PointerFunctions___TFEsPs20_ArrayBufferProtocol22_arrayOutOfPlaceUpdateuRd__s16_PointerFunctionwd__7Elementzwx7ElementrfTRGVs22_ContiguousArrayBufferwxS2__SiSiqd___T_ WebURLParser.swift
#2 0x1207eaf3d in _TTSg5TOC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A459ParameterSS____TFSa16_copyToNewBufferfT8oldCountSi_T_ WebURLParser.swift
#3 0x1207f1775 in _TTSf4g_d___TFC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A451ffV10Foundation13URLComponentsGVs10DictionaryOS0_P33_F7A0FBEC69C912D6857459CF87969A459ParameterSS_ WebURLParser.swift
#4 0x1207e4064 in _TFC3API12WebURLParser8parseURLfSSGO6Result6ResultOS_6WebURLOS0_5Error_ WebURLParser.swift:47
#5 0x120574e06 in _TTSf4g___TFFFC8APITests16WebURLParserSpec4specFT_T_U_FT_T_U_FT_T_ WebURLParserSpec.swift:23
#6 0x12056c5ad in _TFFFC8APITests16WebURLParserSpec4specFT_T_U_FT_T_U_FT_T_ WebURLParserSpec.swift
#7 0x120e4f25f in _TFC5Quick7Example3runfT_T_ (Quick:x86_64+0x1625f)
#8 0x120e4f575 in _TToFC5Quick7Example3runfT_T_ (Quick:x86_64+0x16575)
#9 0x120e3b4b9 in __60+[QuickSpec addInstanceMethodForExample:classSelectorNames:]_block_invoke (Quick:x86_64+0x24b9)
#10 0x10ec0ec6b in __invoking___ (CoreFoundation:x86_64+0x79c6b)
#11 0x10ec0eb3f in -[NSInvocation invoke] (CoreFoundation:x86_64+0x79b3f)
#12 0x10e5d28e1 in __24-[XCTestCase invokeTest]_block_invoke_2 (XCTest:x86_64+0x1d8e1)
#13 0x10e610f61 in -[XCTestContext performInScope:] (XCTest:x86_64+0x5bf61)
#14 0x10e5d26e3 in -[XCTestCase invokeTest] (XCTest:x86_64+0x1d6e3)
#15 0x10e5d2fb1 in -[XCTestCase performTest:] (XCTest:x86_64+0x1dfb1)
#16 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#17 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#18 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#19 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#20 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#21 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#22 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#23 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#24 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#25 0x10e61ca85 in __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke (XCTest:x86_64+0x67a85)
#26 0x10e5def26 in -[XCTestObservationCenter _observeTestExecutionForBlock:] (XCTest:x86_64+0x29f26)
#27 0x10e61c924 in -[XCTTestRunSession runTestsAndReturnError:] (XCTest:x86_64+0x67924)
#28 0x10e5baa4f in -[XCTestDriver runTestsAndReturnError:] (XCTest:x86_64+0x5a4f)
#29 0x10e61486d in _XCTestMain (XCTest:x86_64+0x5f86d)
previously allocated by thread T0 here:
#0 0x10d2ec1bc in wrap_malloc (libclang_rt.asan_iossim_dynamic.dylib:x86_64+0x511bc)
#1 0x1215de078 in swift_slowAlloc (libswiftCore.dylib:x86_64+0x22c078)
#2 0x1215de0c3 in _swift_allocObject_ (libswiftCore.dylib:x86_64+0x22c0c3)
#3 0x1207eb2bc in _TTSg5GVs12_ArrayBufferTOC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A459ParameterSS__GS_TS2_SS__s20_ArrayBufferProtocols___TFEsPs20_ArrayBufferProtocol31_forceCreateUniqueMutableBufferfT17countForNewBufferSi14minNewCapacitySi_GVs22_ContiguousArrayBufferwx7Element_ WebURLParser.swift
#4 0x1207eaee6 in _TTSg5TOC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A459ParameterSS____TFSa16_copyToNewBufferfT8oldCountSi_T_ WebURLParser.swift
#5 0x1207f1760 in _TTSf4g_d___TFC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A451ffV10Foundation13URLComponentsGVs10DictionaryOS0_P33_F7A0FBEC69C912D6857459CF87969A459ParameterSS_ WebURLParser.swift
#6 0x1207e4064 in _TFC3API12WebURLParser8parseURLfSSGO6Result6ResultOS_6WebURLOS0_5Error_ WebURLParser.swift:47
#7 0x120574e06 in _TTSf4g___TFFFC8APITests16WebURLParserSpec4specFT_T_U_FT_T_U_FT_T_ WebURLParserSpec.swift:23
#8 0x12056c5ad in _TFFFC8APITests16WebURLParserSpec4specFT_T_U_FT_T_U_FT_T_ WebURLParserSpec.swift
#9 0x120e4f25f in _TFC5Quick7Example3runfT_T_ (Quick:x86_64+0x1625f)
#10 0x120e4f575 in _TToFC5Quick7Example3runfT_T_ (Quick:x86_64+0x16575)
#11 0x120e3b4b9 in __60+[QuickSpec addInstanceMethodForExample:classSelectorNames:]_block_invoke (Quick:x86_64+0x24b9)
#12 0x10ec0ec6b in __invoking___ (CoreFoundation:x86_64+0x79c6b)
#13 0x10ec0eb3f in -[NSInvocation invoke] (CoreFoundation:x86_64+0x79b3f)
#14 0x10e5d28e1 in __24-[XCTestCase invokeTest]_block_invoke_2 (XCTest:x86_64+0x1d8e1)
#15 0x10e610f61 in -[XCTestContext performInScope:] (XCTest:x86_64+0x5bf61)
#16 0x10e5d26e3 in -[XCTestCase invokeTest] (XCTest:x86_64+0x1d6e3)
#17 0x10e5d2fb1 in -[XCTestCase performTest:] (XCTest:x86_64+0x1dfb1)
#18 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#19 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#20 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#21 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#22 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#23 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#24 0x10e5d0077 in __27-[XCTestSuite performTest:]_block_invoke (XCTest:x86_64+0x1b077)
#25 0x10e5cfc67 in -[XCTestSuite _performProtectedSectionForTest:testSection:] (XCTest:x86_64+0x1ac67)
#26 0x10e5cfe4d in -[XCTestSuite performTest:] (XCTest:x86_64+0x1ae4d)
#27 0x10e61ca85 in __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke (XCTest:x86_64+0x67a85)
#28 0x10e5def26 in -[XCTestObservationCenter _observeTestExecutionForBlock:] (XCTest:x86_64+0x29f26)
#29 0x10e61c924 in -[XCTTestRunSession runTestsAndReturnError:] (XCTest:x86_64+0x67924)
SUMMARY: AddressSanitizer: heap-use-after-free WebURLParser.swift in _TTSf4g_d___TFC3API12WebURLParserP33_F7A0FBEC69C912D6857459CF87969A451ffV10Foundation13URLComponentsGVs10DictionaryOS0_P33_F7A0FBEC69C912D6857459CF87969A459ParameterSS_
Shadow bytes around the buggy address:
0x1c0c000514c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x1c0c000514d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x1c0c000514e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x1c0c000514f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x1c0c00051500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x1c0c00051510: fa fa fa fa fd fd[fd]fd fd fd fd fd fa fa fa fa
0x1c0c00051520: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
0x1c0c00051530: 00 00 00 00 fa fa fa fa fd fd fd fd fd fd fd fd
0x1c0c00051540: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
0x1c0c00051550: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
0x1c0c00051560: 00 00 00 04 fa fa fa fa fd fd fd fd fd fd fd fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==32504==ABORTING
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
(lldb) thread info -s
API was compiled with optimization - stepping may behave oddly; variables may not be available.
thread #1: tid = 0x4092daf, 0x000000010d2f3980 libclang_rt.asan_iossim_dynamic.dylib`__asan::AsanDie(), queue = 'com.apple.main-thread', stop reason = Use of deallocated memory
{
"access_size" : 8,
"access_type" : 1,
"address" : 105965435791536,
"description" : "heap-use-after-free",
"instrumentation_class" : "AddressSanitizer",
"pc" : 4840167792,
"stop_type" : "fatal_error"
}
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = Use of deallocated memory
frame #0: 0x000000010d2f3980 libclang_rt.asan_iossim_dynamic.dylib`__asan::AsanDie()
frame #1: 0x000000010d3088e8 libclang_rt.asan_iossim_dynamic.dylib`__sanitizer::Die() + 88
frame #2: 0x000000010d2f1257 libclang_rt.asan_iossim_dynamic.dylib`__asan::ScopedInErrorReport::~ScopedInErrorReport() + 311
frame #3: 0x000000010d2f0cc8 libclang_rt.asan_iossim_dynamic.dylib`__asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) + 344
frame #4: 0x000000010d2f1e8e libclang_rt.asan_iossim_dynamic.dylib`__asan_report_store8 + 46
frame #5: 0x00000001207f1970 API`specialized WebURLParser.f(URLComponents) -> [WebURLParser.Parameter : String] [inlined] generic specialization <(API.WebURLParser.(Parameter in _F7A0FBEC69C912D6857459CF87969A45), Swift.String)> of Swift._ContiguousArrayBuffer.count.setter : Swift.Int at WebURLParser.swift:0 [opt]
frame #6: 0x00000001207f1968 API`specialized WebURLParser.f(URLComponents) -> [WebURLParser.Parameter : String] [inlined] generic specialization <(API.WebURLParser.(Parameter in _F7A0FBEC69C912D6857459CF87969A45), Swift.String)> of Swift._ArrayBuffer.count.setter : Swift.Int at WebURLParser.swift:0 [opt]
frame #7: 0x00000001207f1968 API`specialized WebURLParser.f(URLComponents) -> [WebURLParser.Parameter : String] [inlined] generic specialization <(API.WebURLParser.(Parameter in _F7A0FBEC69C912D6857459CF87969A45), Swift.String)> of Swift.Array._appendElementAssumeUniqueAndCapacity (Swift.Int, newElement : A) -> () at WebURLParser.swift:0 [opt]
frame #8: 0x00000001207f1968 API`specialized WebURLParser.f(URLComponents) -> [WebURLParser.Parameter : String] [inlined] generic specialization <(API.WebURLParser.(Parameter in _F7A0FBEC69C912D6857459CF87969A45), Swift.String)> of Swift.Array.append (A) -> () at WebURLParser.swift:0 [opt]
frame #9: 0x00000001207f1954 API`specialized WebURLParser.f(URLComponents) -> [WebURLParser.Parameter : String] [inlined] generic specialization <Swift.Array<Foundation.URLQueryItem> with Swift.Array<Foundation.URLQueryItem> : Swift.Sequence in Swift, (API.WebURLParser.(Parameter in _F7A0FBEC69C912D6857459CF87969A45), Swift.String)> of (extension in Swift):Swift.Sequence.flatMap <A> ((A.Iterator.Element) throws -> Swift.Optional<A1>) throws -> Swift.Array<A1> at WebURLParser.swift:0 [opt]
* frame #10: 0x00000001207f1900 API`specialized WebURLParser.f(components=<unavailable>) -> [WebURLParser.Parameter : String] at WebURLParser.swift:25 [opt]
frame #11: 0x00000001207e4065 API`WebURLParser.parseURL(String) -> Result<WebURL, WebURLParser.Error> [inlined] API.WebURLParser.(f in _F7A0FBEC69C912D6857459CF87969A45) (Foundation.URLComponents) -> Swift.Dictionary<API.WebURLParser.(Parameter in _F7A0FBEC69C912D6857459CF87969A45), Swift.String> at WebURLParser.swift:0 [opt]
frame #12: 0x00000001207e405d API`WebURLParser.parseURL(url=<unavailable>) -> Result<WebURL, WebURLParser.Error> at WebURLParser.swift:47 [opt]
frame #13: 0x0000000120574e07 APITests`specialized WebURLParserSpec.(parser=0x0000602000015290) -> ()).(closure #1).(closure #1) at WebURLParserSpec.swift:23 [opt]
frame #14: 0x000000012056c5ae APITests`WebURLParserSpec.(spec() -> ()).(closure #1).(closure #1) at WebURLParserSpec.swift:0 [opt]
frame #15: 0x0000000120e4f260 Quick`Quick.Example.run () -> () + 624
frame #16: 0x0000000120e4f576 Quick`@objc Quick.Example.run () -> () + 22
frame #17: 0x0000000120e3b4ba Quick`__60+[QuickSpec addInstanceMethodForExample:classSelectorNames:]_block_invoke + 107
frame #18: 0x000000010ec0ec6c CoreFoundation`__invoking___ + 140
frame #19: 0x000000010ec0eb40 CoreFoundation`-[NSInvocation invoke] + 320
frame #20: 0x000000010e5d28e2 XCTest`__24-[XCTestCase invokeTest]_block_invoke_2 + 491
frame #21: 0x000000010e610f62 XCTest`-[XCTestContext performInScope:] + 190
frame #22: 0x000000010e5d26e4 XCTest`-[XCTestCase invokeTest] + 254
frame #23: 0x000000010e5d2fb2 XCTest`-[XCTestCase performTest:] + 565
frame #24: 0x000000010e5d0078 XCTest`__27-[XCTestSuite performTest:]_block_invoke + 300
frame #25: 0x000000010e5cfc68 XCTest`-[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
frame #26: 0x000000010e5cfe4e XCTest`-[XCTestSuite performTest:] + 214
frame #27: 0x000000010e5d0078 XCTest`__27-[XCTestSuite performTest:]_block_invoke + 300
frame #28: 0x000000010e5cfc68 XCTest`-[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
frame #29: 0x000000010e5cfe4e XCTest`-[XCTestSuite performTest:] + 214
frame #30: 0x000000010e5d0078 XCTest`__27-[XCTestSuite performTest:]_block_invoke + 300
frame #31: 0x000000010e5cfc68 XCTest`-[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
frame #32: 0x000000010e5cfe4e XCTest`-[XCTestSuite performTest:] + 214
frame #33: 0x000000010e61ca86 XCTest`__44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
frame #34: 0x000000010e5def27 XCTest`-[XCTestObservationCenter _observeTestExecutionForBlock:] + 574
frame #35: 0x000000010e61c925 XCTest`-[XCTTestRunSession runTestsAndReturnError:] + 281
frame #36: 0x000000010e5baa50 XCTest`-[XCTestDriver runTestsAndReturnError:] + 254
frame #37: 0x000000010e61486e XCTest`_XCTestMain + 559
frame #38: 0x000000010d212679 xctest`___lldb_unnamed_symbol3$$xctest + 1420
frame #39: 0x000000011025d65d libdyld.dylib`start + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment