Commit d3704b9
Han Wang
test(lmp): reject negative array counts in expected_ref parser
CodeRabbit (review #4211393623) noted that a negative `count` in a
sidecar array header (e.g. `expected_e -3`) would pass the existing
length check (`i + n > len(lines)` is false for n<0), then `range(-3)`
yields no values, and `i += -3` rewinds the read position — at best
re-parsing earlier lines, at worst looping forever on a long file.
Add an explicit `n < 0` guard with a clear message naming both the
array and the file.1 parent a444251 commit d3704b9
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
0 commit comments