Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-2811

heap-use-after-free: LiveQuerier > '_stopping'?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 3.1.0
    • 3.1.0
    • LiteCore
    • Security Level: Public
    • None
    • LiteCore 94
    • 5

    Description

      Accessed in > LiveQuerier::stop(): LiveQuerier.cc:87

      READ of size 1 at 0x60f000083d5a thread T0: 
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.759031-0800 xctest[85439:56748631]     #0 0x10011649e1be in bool std::__1::__cxx_atomic_load<bool>(std::__1::__cxx_atomic_base_impl<bool> const*, std::__1::memory_order) atomic:1003
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.759351-0800 xctest[85439:56748631]     #1 0x10011649e08d in std::__1::__atomic_base<bool, false>::load(std::__1::memory_order) const atomic:1607
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.759559-0800 xctest[85439:56748631]     #2 0x100116499ef9 in std::__1::__atomic_base<bool, false>::operator bool() const atomic:1611
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.759784-0800 xctest[85439:56748631]     #3 0x10011649ed8c in litecore::LiveQuerier::stop()::$_0::operator()(litecore::DataFile*) const LiveQuerier.cc:87
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.760018-0800 xctest[85439:56748631]     #4 0x1001164979ed in bool litecore::access_lock<litecore::DataFile*, std::__1::recursive_mutex>::useLocked<bool, litecore::LiveQuerier::stop()::$_0>(litecore::LiveQuerier::stop()::$_0) access_lock.hh:171
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.760214-0800 xctest[85439:56748631]     #5 0x100116497626 in litecore::LiveQuerier::stop() LiveQuerier.cc:84
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.760424-0800 xctest[85439:56748631]     #6 0x100115f42b3a in C4Query::enableObserver(litecore::C4QueryObserverImpl*, bool) c4Query.cc:275
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.760652-0800 xctest[85439:56748631]     #7 0x1001160da793 in litecore::C4QueryObserverImpl::~C4QueryObserverImpl() c4QueryImpl.hh:129
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.760899-0800 xctest[85439:56748631]     #8 0x1001160d9c14 in litecore::C4QueryObserverImpl::~C4QueryObserverImpl() c4QueryImpl.hh:127
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.761160-0800 xctest[85439:56748631]     #9 0x1001160d9c3b in litecore::C4QueryObserverImpl::~C4QueryObserverImpl() c4QueryImpl.hh:127
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.761426-0800 xctest[85439:56748631]     #10 0x1001160cb703 in c4queryobs_free c4CAPI.cc:1449
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.761669-0800 xctest[85439:56748631]     #11 0x100115ae4d97 in -[CBLQueryObserver stopAndFree] CBLQueryObserver.m:76
      [2022-02-11T13:43:10.018Z] 2022-02-11 05:43:09.761912-0800 xctest[85439:56748631]     #12 0x100115ab97f7 in -[CBLQuery removeChangeListenerWithToken:] CBLQuery.mm:293
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.762137-0800 xctest[85439:56748631]     #13 0x100115bd0210 in Query.removeChangeListener(withToken:) Query.swift:129
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.762400-0800 xctest[85439:56748631]     #14 0x100115404ae6 in QueryTest.testLiveQuery(query:) QueryTest.swift:1799
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.762635-0800 xctest[85439:56748631]     #15 0x100115403223 in QueryTest.testJSONLiveQuery() QueryTest.swift:1767
      

      Released in > LiveQuerier::~LiveQuerier(): LiveQuerier.cc:56

      freed by thread T6 here:
      #1 0x100116495447 in litecore::LiveQuerier::~LiveQuerier() LiveQuerier.cc:56
      

      Allocated here: C4Query::enableObserver: c4Query.cc:239

      previously allocated by thread T0 here:
       #0 0x10c6d823d in wrap__Znwm+0x7d (libclang_rt.asan_iossim_dynamic.dylib:x86_64+0x4e23d)
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.776846-0800 xctest[85439:56748631]     #1 0x100115f426f7 in C4Query::enableObserver(litecore::C4QueryObserverImpl*, bool) c4Query.cc:239
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.777014-0800 xctest[85439:56748631]     #2 0x1001160d9c92 in litecore::C4QueryObserverImpl::setEnabled(bool) c4QueryImpl.hh:133
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.777211-0800 xctest[85439:56748631]     #3 0x1001160cb63f in c4queryobs_setEnabled c4CAPI.cc:1445
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.777437-0800 xctest[85439:56748631]     #4 0x100115ae5df9 in -[CBLQueryObserver observerEnable:] CBLQueryObserver.m:145
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.777641-0800 xctest[85439:56748631]     #5 0x100115ae4c7f in -[CBLQueryObserver start] CBLQueryObserver.m:69
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.777860-0800 xctest[85439:56748631]     #6 0x100115ab9117 in -[CBLQuery addChangeListenerWithQueue:listener:] CBLQuery.mm:281
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.778061-0800 xctest[85439:56748631]     #7 0x100115bcee64 in Query.addChangeListener(withQueue:_:) Query.swift:102
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.778289-0800 xctest[85439:56748631]     #8 0x100115bce424 in Query.addChangeListener(_:) Query.swift:83
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.778476-0800 xctest[85439:56748631]     #9 0x10011540473d in QueryTest.testLiveQuery(query:) QueryTest.swift:1781
      [2022-02-11T13:43:10.019Z] 2022-02-11 05:43:09.778666-0800 xctest[85439:56748631]     #10 0x100115403223 in QueryTest.testJSONLiveQuery() QueryTest.swift:1767
      

      Attachments

        Issue Links

          Activity

            People

              jianmin.zhao Jianmin Zhao
              Jayahari.Vavachan Jay Vavachan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty