mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-05 16:07:33 +00:00
The decoder allocated total_length bytes straight from the upstream prelude (up to ~4 GiB) and sliced headers by an unchecked headers_length, which could panic in the decode goroutine outside gin's recovery and crash the process. Reject frames whose headers exceed 128 KiB or the frame, or whose payload exceeds 16 MiB (the AWS EventStream protocol limits), before allocating. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>