The LCOV format allows an optional checksum field on DA lines: DA:line_number,execution_count[,checksum]
grcov's byte-level LCOV parser does not consume the optional checksum field after reading the execution count. Depending on what character the checksum starts with, this causes different issues.
- checksum starts with
e (interpreted as end_of_record):
SF:test.py
DA:1,0,e3ZBlmsTAEA3QwKvJLg9CA
LH:0
LF:1
end_of_record
A panic occurred at src/parser.rs:194: called `Option::unwrap()` on a `None` value
- checksum starts with a valid key prefix like
FN, DA, FNDA:
SF:test.py
DA:1,0,FNsomechecksum
LH:0
LF:1
end_of_record
Error parsing file: Invalid record: 'FN at line 3'
- checksum starts with
SF or BRDA:
SF:test.py
DA:1,0,SFsomechecksum
LH:0
LF:1
end_of_record
No error, but the checksum is interpreted as a new source file record, silently corrupting the output.
I have tried tackling the issue here #1500 before realising it is more widespread, and not isolated to just checksums starting with e.
The LCOV format allows an optional checksum field on DA lines:
DA:line_number,execution_count[,checksum]grcov's byte-level LCOV parser does not consume the optional checksum field after reading the execution count. Depending on what character the checksum starts with, this causes different issues.
e(interpreted asend_of_record):FN,DA,FNDA:SForBRDA:I have tried tackling the issue here #1500 before realising it is more widespread, and not isolated to just checksums starting with
e.