hardbyte / hardbyte/python-can

can.BLFReader: Stuck printing "Unknown object header version (0)", cannot error handle.

Đang mở
#1,581 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Python
Star
1.6k
Fork
697
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Describe the bug
When reading certain BLF files that may be corrupt, the can.BLFReader() function gets stuck with the terminal output continuously printing "Unknown object header version (0)". Because this does not raise an error flag, there is no way to get out of this loop using traditional error handling methods. It seems maybe modifying the following section of blf.py would prevent the script from getting stuck here.

```else:
LOG.warning("Unknown object header version (%d)", header_version)
pos = next_pos
continue
```

To:

```else:
raise BLFParseError("Unknown object header version (%d)", header_version) from None
```

### To Reproduce
I am not sure what is wrong with the particular BLF file this is getting stuck in but I cannot share it unfortunately.

### Expected behavior
If "Unknown Object header Version (0)" is encountered, raise an exception flag so that we can stop processing the faulted file.

### Additional context

OS and version: Windows 10
Python version: 3.11.2
python-can version: 4.1.0

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.