Description
I was using the library to parse some CAN data files (in BLF format) that I recorded with CANoe 11.0.42 - 64bit.
And the library reports a same 'LOBJ' header check exception for most files, and then I traced the error a bit, and found out that the error was actually caused by a wrong offset calculation for next PDU (thus the header wasn't well recognized).
Here is the header info print out:
(b'LOBJ', 32, 1, 197, 65)
(b'LOBJ', 32, 1, 205, 65)
(b'LOBJ', 32, 1, 216, 65)
(b'LOBJ', 32, 1, 538, 65)
(b'LOBJ', 32, 1, 1043, 65)
(b'LOBJ', 32, 1, 335, 65)
(b'LOBJ', 32, 1, 104, 48)
(b'LOBJ', 32, 1, 104, 48)
(b'LOBJ', 32, 1, 104, 48)
(b'LOBJ', 32, 1, 104, 48)
(b'LOBJ', 32, 1, 104, 48)
(b'LOBJ', 32, 1, 96, 49)
(b'LOBJ', 32, 1, 96, 49)
(b'LOBJ', 32, 1, 96, 49)
(b'LOBJ', 32, 1, 96, 49)
(b'LOBJ', 32, 1, 104, 48)
(b'LOBJ', 32, 1, 96, 49)
(b'LOBJ', 32, 1, 40, 31)
(b'LOBJ', 32, 1, 40, 31)
(b'LOBJ', 32, 1, 96, 49)
(b'LOBJ', 32, 1, 116, 66)
(b'LOBJ', 32, 1, 134, 66)
(b'BJ \x00', 1, 134, 4325376, 131072)
Traceback (most recent call last):
...
File "C:\Python\Python36-32\lib\site-packages\can\io\blf.py", line 177, in iter
raise BLFParseError()
can.io.blf.BLFParseError
I checked the raw data, and found out that when the 'size' in the 'object header' is '134', the real data size is also '134', so the real PDU is not padded to 4N length, thus
next_pos = pos + obj_size + (obj_size % 4)
won't work for this case.
Does anyone know the reason behind? Any quick solution or suggestion that? I have a quick and dirty hack to that, which is to calculate 2 possible next_pos
and retry when header check is failed, but I mean it doesn't answer the question...