Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bytes: fix isBytes check #1964

Closed
wants to merge 1 commit into from

Conversation

ChALkeR
Copy link

@ChALkeR ChALkeR commented Aug 26, 2021

Otherwise this passed on e.g. an array of NaNs.

As a rule of thumb, using fail-closed checks is safer than using fail-open checks, e.g. if (!(...check for good values)) fail is safer than if (check for bad values) fail, as e.g. NaN here bypasses any of those, returning falsy on every of v < 0, v >= 256 and v % 1 checks.

Refs:

@ChALkeR ChALkeR force-pushed the chalker/fix-isBytes branch from 09951c8 to af9f4c5 Compare August 26, 2021 19:18
@ricmoo ricmoo added bug Verified to be an issue. on-deck This Enhancement or Bug is currently being worked on. labels Aug 31, 2021
@ricmoo
Copy link
Member

ricmoo commented Sep 16, 2021

I completely agree! I'll update this soon.

Thanks! :)

@ricmoo
Copy link
Member

ricmoo commented Oct 20, 2021

Merged into 5.5.0.

Thanks! :)

@ricmoo ricmoo closed this Oct 20, 2021
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants