You've already forked agentic-coding-workflow
bugfix
This commit is contained in:
@@ -68,7 +68,10 @@ func sliceLines(s string, line, limit *int) string {
|
||||
}
|
||||
end := len(lines)
|
||||
if limit != nil && *limit >= 0 {
|
||||
if start+*limit < end {
|
||||
// overflow-safe:用剩余行数为上限做钳制,避免 start+*limit 在 *limit 很大
|
||||
// (如 math.MaxInt)时整数溢出为负,绕过下界判断后导致 lines[start:end] panic。
|
||||
remaining := len(lines) - start
|
||||
if *limit < remaining {
|
||||
end = start + *limit
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user