Skip to content

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

Open
@HiFiPhile

Description

@HiFiPhile

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions