Hasty Briefsbeta

Bilingual

Fixing cringeworthy bugs in the OpenBSD console code

19 hours ago
  • The article details multiple bugs found in the UTF-8 decoding logic of OpenBSD's wscons console code, which had been broken for nine years.
  • Initial bugs included incorrect bit-checking for multi-byte sequences, causing failures for codepoints above 0xFF.
  • Fixing the first bug allowed two-byte characters to work, but three- and four-byte sequences still failed due to program flow errors.
  • Buffer management issues were discovered: counting bytes instead of characters led to garbled output and console hangs.
  • The bugs allowed console hangs and exploitable behavior, though not considered critical.
  • The author finds it surprising that such basic mistakes existed in OpenBSD, given its reputation for code correctness and auditing.