Repository navigation
Commit 089e5d2
committed
fix(patterns): use logical line starts for XOR-decoded SC2 context
_decoded_literal_xor_calls reports line numbers via get_line_number, which
counts logical separators (CR, form feed, U+2028/U+2029), but the SC2 call
site indexed context with LF-only line offsets. A leading comment containing
U+2028 separators pushed line_num past the LF-offset array, raising
IndexError and dropping every supply-chain finding for the file. Index the
context on the existing logical_line_starts offsets instead, consistent with
the decoder.
Add a mixed-file regression test with two U+2028 characters in a leading
comment, an independent plaintext SC2 match, and the XOR fixture last,
asserting both SC2 findings survive with correct line numbers.
Signed-off-by: Deepak Jain <[email protected]>1 parent 6e9601f commit 089e5d2
2 files changed
Lines changed: 37 additions & 3 deletions
File tree
- src/skillspector/nodes/analyzers
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1355 | 1355 | | |
1356 | 1356 | | |
1357 | 1357 | | |
1358 | | - | |
1359 | | - | |
1360 | 1358 | | |
1361 | 1359 | | |
1362 | 1360 | | |
| |||
1369 | 1367 | | |
1370 | 1368 | | |
1371 | 1369 | | |
1372 | | - | |
| 1370 | + | |
1373 | 1371 | | |
1374 | 1372 | | |
1375 | 1373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2187 | 2187 | | |
2188 | 2188 | | |
2189 | 2189 | | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
2190 | 2226 | | |
2191 | 2227 | | |
2192 | 2228 | | |
| |||
0 commit comments