Skip to content

Conversation

@masayuki0812
Copy link
Contributor

In very rare cases, the CRC calculation becomes incorrect even though the ROM file itself is generated correctly, and the CRC value differs on each run.

The suspected cause is that read() may return -1 at end-of-file, but the return value is stored in a uint32_t. As a result, the loop condition evaluates as true and the CRC is updated unintentionally.

With this change, the issue no longer occurs in my environment. I also verified that normal CRC calculations are unaffected.

This issue is extremely difficult to reproduce, but I would appreciate it if you could review it when you have time.

@sanni sanni merged commit 3d59aa6 into sanni:master Dec 23, 2025
3 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.

2 participants