# io: 读取限制超出

- **ID:** `go/io-reader-too-large`
- **领域:** go
- **类别:** io_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

使用 io.LimitReader 时限制小于实际数据大小，导致达到限制时 Read 返回错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   r := io.LimitReader(file, maxSize); data, err := io.ReadAll(r); if err != nil { ... }; if len(data) == maxSize { /* handle overflow */ }
   ```

## 无效尝试

- **** — May cause memory exhaustion if data is maliciously large. (60% 失败率)
- **** — Leads to incomplete data processing and potential corruption. (90% 失败率)
