Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebUSB example crash when a max size packet and a ZLP received #2632

Open
HiFiPhile opened this issue May 9, 2024 · 0 comments
Open

WebUSB example crash when a max size packet and a ZLP received #2632

HiFiPhile opened this issue May 9, 2024 · 0 comments

Comments

@HiFiPhile
Copy link
Collaborator

HiFiPhile commented May 9, 2024

Operating System

Windows 10

Board

STM32F723E-DISCO

Firmware

examples\device\webusb_serial

What happened ?

Receiver stopped working, seems ZLP caused error in console:

application.js:42 Uncaught (in promise) RangeError: Offset is outside the bounds of the DataView
    at DataView.prototype.getInt8 (<anonymous>)
    at port.onReceive (application.js:42:20)
    at serial.js:35:14
                        port.onReceive = data => {
                                  let textDecoder = new TextDecoder();
                                  console.log(textDecoder.decode(data));
 #Crashed here#  ->      if (data.getInt8() === 13) {
                                    currentReceiverLine = null;
                                  } else {
                                    appendLines('receiver_lines', textDecoder.decode(data));
                                  }
                                };

Never done JS, not sure how to fix :)

How to reproduce ?

Run #911 and send ZLP

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

  CDC xfer callback
  Queue EP 02 with 64 bytes ...
  Queue EP 83 with 64 bytes ...
  Queue EP 82 with 64 bytes ...
USBD Xfer Complete on EP 83 with 64 bytes
  VENDOR xfer callback
  Queue EP 83 with 0 bytes ...
USBD Xfer Complete on EP 82 with 64 bytes
  CDC xfer callback
  Queue EP 82 with 0 bytes ...
USBD Xfer Complete on EP 83 with 0 bytes
  VENDOR xfer callback
USBD Xfer Complete on EP 82 with 0 bytes
  CDC xfer callback
USBD Xfer Complete on EP 02 with 64 bytes
  CDC xfer callback
  Queue EP 02 with 64 bytes ...
  Queue EP 83 with 64 bytes ...
  Queue EP 82 with 64 bytes ...
USBD Xfer Complete on EP 82 with 64 bytes
  CDC xfer callback
  Queue EP 82 with 0 bytes ...
USBD Xfer Complete on EP 82 with 0 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant