Closed diggit closed 1 year ago
Hi, thanks for the report; unclaim()
should be a no-op if handle is not set, but it looks like is_claimed()
returns the wrong thing:
[[nodiscard]] auto is_claimed() const noexcept -> bool
{
return device_handle_ == nullptr;
}
Should be != nullptr
, will fix.
I planned to use this library for a project which I had to abandon, so there are definitely bugs in basic features like this; I might get to use it for another project in not-so-distant future though :) feel free to report other problems / submit PRs if you find other issues.
Should be
!= nullptr
, will fix.
Oh, I totally missed that. Thanks for quick fix!
I believe, this is not fully fixed yet, as basic_usb_interface::device_handle_
is missing initialization and thus is_claimed()
may incorrectly return because device_handle_
holds some garbage.
Hi, first of all, thank you for all your work... díky :)
I am trying to use your asio wrapper of libusb and I am struggling a little bit. It's all blowing up in interface claiming. There is uninitialized data access resulting in null pointer de-reference.
My code is just slightly modified example from readme.
Constructing interface object calls
claim
.claim
itself callsunclaim
at first.unclaim
calls::libusb_release_interface
which takes device handler as argument.Device handle pointer is obtained by calling
device_handle
, which returnsdevice_handle_
, but this data member is not set yet. That happens at the end ofclaim
fcn.Unless I am using it wrong, there is several ways to fix this:
device_handle_
has to be set before callingunclaim
unclaim
which accepts device handle directly (available in claim fcn).unclaim
whendevice_handle_
is not valid