Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56898

Bluetooth Service - Writing from Central to Service - Invalid Offset

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.8.0
    • 5.8.0 Beta
    • None
    • Mac OSX 10.12.1
      QT 5.8.0 Beta, Build 581
    • 3375871a93f8d366f1eca5b823e4337af3aecd8c 78402e8f96a49462677cd07ae57c7d830228ec3b 72fbcaf6f50eda25aace772d49a575ddaae852c3

    Description

      When app is operating as server to advertise services the central can connect and read values from the qt advertised service. When attempting to write values back to the service from the central, qt service returns an invalid offset.

      QT Source

      osxbtperipheralmanager.mm
      if (request.offset > data.length || request.value.length > data.length - request.offset)
              return CBATTErrorInvalidOffset;
      

      The offset is zero, so if the new value request.value is longer than the current value data it throws an error setting the initial value to something longer. QT then erorrs saying:

      2016-11-02 22:25:33.071 Peripheral[22661:256601] -[_NSInlineData replaceBytesInRange:withBytes:]: unrecognized selector sent to instance 0x7ff73e776640
      2016-11-02 22:25:33.073 Peripheral[22661:256601] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSInlineData replaceBytesInRange:withBytes:]: unrecognized selector sent to instance 0x7ff73e776640'
      *** First throw call stack:
      (
          0   CoreFoundation                      0x00007fffc5d0648b __exceptionPreprocess + 171
          1   libobjc.A.dylib                     0x00007fffda468cad objc_exception_throw + 48
          2   CoreFoundation                      0x00007fffc5d87c94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
          3   CoreFoundation                      0x00007fffc5c78b55 ___forwarding___ + 1061
          4   CoreFoundation                      0x00007fffc5c786a8 _CF_forwarding_prep_0 + 120
          5   QtBluetooth                         0x0000000106d4a23f _ZeqRK24QLowEnergyDescriptorDataS1_ + 99775
          6   CoreBluetooth                       0x00007fffc586959f -[CBPeripheralManager handleSetAttributeValues:] + 1134
          7   CoreBluetooth                       0x00007fffc586a9b6 __34-[CBXpcConnection handleMsg:args:]_block_invoke + 77
          8   libdispatch.dylib                   0x00007fffdad19f5f _dispatch_call_block_and_release + 12
          9   libdispatch.dylib                   0x00007fffdad11128 _dispatch_client_callout + 8
          10  libdispatch.dylib                   0x00007fffdad27b97 _dispatch_queue_serial_drain + 896
          11  libdispatch.dylib                   0x00007fffdad19d41 _dispatch_queue_invoke + 1046
          12  libdispatch.dylib                   0x00007fffdad12ee0 _dispatch_root_queue_drain + 476
          13  libdispatch.dylib                   0x00007fffdad12cb7 _dispatch_worker_thread3 + 99
          14  libsystem_pthread.dylib             0x00007fffdaf5e736 _pthread_wqthread + 1299
          15  libsystem_pthread.dylib             0x00007fffdaf5e211 start_wqthread + 13
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException

      Attachments

        For Gerrit Dashboard: QTBUG-56898
        # Subject Branch Project Status CR V

        Activity

          People

            tpochep Timur Pocheptsov
            bryana Bryan Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes