Commit 5b73d10
Anivar A Aravind
Fix critical KV cache crash bug causing std::length_error
Fixes integer underflow when n_discard >= cache_tokens.size() that causes
std::length_error crashes. This commonly occurs during KV cache context
shifting, particularly with Chinese text translation workloads.
The fix adds proper bounds checking before resizing the cache_tokens vector.
Fixes #7711 parent 24f18f7 commit 5b73d10
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1711 | 1711 | | |
1712 | 1712 | | |
1713 | 1713 | | |
1714 | | - | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
1715 | 1720 | | |
1716 | 1721 | | |
1717 | 1722 | | |
| |||
0 commit comments