Skip to content

Commit

Permalink
Warn on always false integer reads and comparisons.
Browse files Browse the repository at this point in the history
When reading an integer of a specific size and comparing it to an integer of a
larger size where any of the upper bits are set we will now emit a warning
because the comparison is always false.

These will always evaluate to false because the "extra" bytes are non-zero:

uint8(0) == 0x1100
uint16(0) == 0x110000
uint32(0) == 0x1100000000

While I'm here, move a test into a better place for it. I added it in the wrong
place in ccbc405.

Fixes VirusTotal#1918.
  • Loading branch information
wxsBSD committed May 7, 2023
1 parent c506276 commit 0839ab3
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 151 deletions.

0 comments on commit 0839ab3

Please sign in to comment.