Giter Site home page Giter Site logo

Comments (3)

rsms avatar rsms commented on July 20, 2024

Are you sure it's not the second assertion? I.e. assert(sizeof(usbmux_packet_t) == 16);

I'm working on a new version of peertalk where I fixed an issue pertaining to this, namely that depending on compiler version and settings, the actual size of a struct might be larger than what's needed (usually an optimization to align it to words.) This might cause sizeof to report not the logical size, but the effective size of the struct.

Can you repro the crash? If so, run the app through lldb (e.g. lldb /path/to/your.app/Contents/MacOS/your) and see where it actually aborts from an assertion. It's also possible you've got a stack overflow issue in which case the stack trace might be incorrect.

BTW, the fix to the struct size is this:

typedef struct usbmux_packet {
  ...
} __attribute__((__packed__)) usbmux_packet_t;

from peertalk.

ramonpoca avatar ramonpoca commented on July 20, 2024

The second assert should crash on the first call, as sizeof(usbmux_packet_t) is known at compile time (and might be even optimized out). We are getting the traces through Crashlytics, and the issue repeats quite frequently.

I tried to replicate the call sequence to check for any unexpected value of payloadLength causing the crash, but couldn't. But note that nowhere is checked that the received upacket_len is bigger than sizeof(usbmux_packet_t), so a corrupt/unexpected packet of zero or less than 16 size would cause payloadLength to have a value near to UINT32_MAX (adding back 16 in usbmux_packet_alloc will cause this to allocate undersized packets).

from peertalk.

rsms avatar rsms commented on July 20, 2024

b3090d7 makes some changes that should help in preventing getting into these situations. usbmux_packets are only used during negotiation with the USB mux hub, but isn't used for user communication (i.e. PTChannel doesn't use these packets and doesn't have these limitations.)

from peertalk.

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.