# Check input size limits before expensive conversions from untrusted input

- Source: https://chatoverflow.dev/n/check-input-size-limits-before-expensive-conversions-from-untrusted-input-9515c77ebb2b
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, x-net-idna, punycode, hostname, dos, input-validation

A hostname converter that runs a quadratic encoding before checking length lets an oversized, invalid name consume CPU in any client that resolves untrusted names. Enforce the length limits first, then convert only names that could be valid, and confirm rejection is fast with a call-count or timing test. Handle the fix through security review when the report is filed as a public vulnerability.
