Skip to content

Fix hang on UTF-16 LE BOM file#636

Merged
danmar merged 12 commits into
cppcheck-opensource:masterfrom
chrchr-github:chr_utf16
May 27, 2026
Merged

Fix hang on UTF-16 LE BOM file#636
danmar merged 12 commits into
cppcheck-opensource:masterfrom
chrchr-github:chr_utf16

Conversation

@chrchr-github

@chrchr-github chrchr-github commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

fixes #637

@chrchr-github chrchr-github changed the title Fix hang on UTF- 16 LE BOM file Fix hang on UTF-16 LE BOM file Mar 27, 2026
@firewave

firewave commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

Yeah - there's several places which lack checks for EOF. I have WIP tests for that and other corner cases/gaps somewhere - something to be done in preparation of #566.

@firewave

Copy link
Copy Markdown
Collaborator

With #647 it should be possible to write a test which uses the input in question.

@chrchr-github

Copy link
Copy Markdown
Contributor Author

With #647 it should be possible to write a test which uses the input in question.

Can we just run the tests with all three options?

@firewave

Copy link
Copy Markdown
Collaborator

Can we just run the tests with all three options?

Yes, if somebody adds the functionality. It didn't seem straight forward to me so I haven't yet. Feel free to do so.

@firewave

Copy link
Copy Markdown
Collaborator

I think I took a wrong turn. That should trigger with regular unit test. So please add a test for it.

@firewave

Copy link
Copy Markdown
Collaborator

I think I took a wrong turn. That should trigger with regular unit test. So please add a test for it.

Ah - you mentioned FileStream in the ticket. Still I think we should have a unit test (if missing).

@chrchr-github

Copy link
Copy Markdown
Contributor Author

So there is also some kind of platform divergence going on...

@chrchr-github

Copy link
Copy Markdown
Contributor Author

@chrchr-github

chrchr-github commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

So there is also some kind of platform divergence going on...

Of course f.write("\xFF\xFE\x3B\x00") does something different on Linux, because why wouldn't it?

~$ hexdump pytest.cpp 
0000000 bfc3 bec3 003b                         
0000006

@chrchr-github chrchr-github marked this pull request as ready for review May 13, 2026 18:21
@danmar

danmar commented May 15, 2026

Copy link
Copy Markdown
Collaborator

I guess CI will be fixed by #641

Comment thread simplecpp.cpp
Comment thread simplecpp.cpp
@danmar

danmar commented May 26, 2026

Copy link
Copy Markdown
Collaborator

@chrchr-github I want to release simplecpp so we can update cppcheck repo before the release. do you want to merge now to get this into the release or rather wait?

@danmar

danmar commented May 26, 2026

Copy link
Copy Markdown
Collaborator

I have approved it, as far as I see it can be merged into the release.

@chrchr-github

Copy link
Copy Markdown
Contributor Author

@chrchr-github I want to release simplecpp so we can update cppcheck repo before the release. do you want to merge now to get this into the release or rather wait?

It's also a hang in cppcheck, so we might as well merge it (I don't have permission though).

@danmar danmar merged commit 4ca0ee6 into cppcheck-opensource:master May 27, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hang on UTF-16 with BOM

4 participants