GithubHelp home page GithubHelp logo

Comments (4)

medusalix avatar medusalix commented on May 25, 2024

Thanks for the detailed bug report and the stack trace 😃. It could be some kind of bug in libusb's implementation of libusb_control_transfer. Could you dig a little bit deeper to find the place/line where libusb_control_transfer is failing (maybe using gdb)?

from xow.

StopMotionCuber avatar StopMotionCuber commented on May 25, 2024

Well, the problem is that handle is a nullpointer and libusb_control_transfer does not like nullpointer as handles.
I'm not sure how to handle that correctly (pun intended).

Also there is a use after free in Log::error("Error in bulk read: %d", transfer->status); as transfer is freed already. I was too lazy to make a PR for that, please fix in one of your commits.

from xow.

medusalix avatar medusalix commented on May 25, 2024

Ah, now I see. So UsbDevice::close sets the handle to nullptr while the dongle thread is still doing its control transfers. The only reason this is being done is to prevent UsbDevice::open from opening the device multiple times. I'm going to replace this with a boolean variable to indicate if the device is currently open. libusb_control_transfer will probably return LIBUSB_ERROR_NO_DEVICE but thats at least better than a crash.

Also there is a use after free

Good catch 👍. Will push that together with the other fix.

from xow.

medusalix avatar medusalix commented on May 25, 2024

@StopMotionCuber I've put checks into place that handle the edge case of removing the device while the pairing is in progress. This also has the benefit of logging the exact place where it errors (as one would expect). Please see if commit 365c2bc fixes your issues.

from xow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.