pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

stdio_usb somehow emits garbage memory to the terminal window via PuTTY/KiTTY

Open JamesDunne opened this issue 1 year ago • 2 comments

See https://github.com/JamesDunne/pico-stdio-usb-bug for a minimal(-ish) reproducible example with no external dependencies required.

Steps to reproduce:

  1. Use Pico board with USB connection to host PC
  2. Build example repo
  3. Flash firmware
  4. Connect PuTTY (or KiTTY) using serial mode to COM5 (or wherever your Pico is)
  5. Observe output until seeing dropped data and/or corrupted terminal output

Example output: image

The output text above indicates some sort of memory overflow bug in KiTTY but their bug should not be triggered by such trivial ASCII-only printf() calls from the Pico. The presence of text like RegDeleteValue clearly indicates a Windows-side memory overflow since none of that text should exist in the Pico binaries.

JamesDunne avatar Sep 04 '22 17:09 JamesDunne

Commenting out the only use of format-specifiers in printf() calls triggers the issue far less often but still triggers it.

image

JamesDunne avatar Sep 04 '22 17:09 JamesDunne

their bug should not be triggered by such trivial ASCII-only printf() calls from the Pico

Why not? They have a bug, and a bad one. This probably could be exploited. This should be reported to Pu/KiTTY as an urgent issue, since it has safety implications.

If anything, this is an excellent repro test case. It's not Pico SDK's job to avoid safety-critical bugs in other software...

KubaO avatar Sep 29 '22 16:09 KubaO

no evidence of this being anything other than a Pu/KiTTY bug

kilograham avatar May 26 '23 15:05 kilograham