Skip to content

Validate Bit shift left amount#2485

Closed
puneetdixit200 wants to merge 1 commit into
gchq:masterfrom
puneetdixit200:fix-bit-shift-left-negative-amount
Closed

Validate Bit shift left amount#2485
puneetdixit200 wants to merge 1 commit into
gchq:masterfrom
puneetdixit200:fix-bit-shift-left-negative-amount

Conversation

@puneetdixit200

Copy link
Copy Markdown

Summary

  • Reject negative Bit shift left amounts before JavaScript shift coercion can turn them into invalid null-byte output.
  • Set the operation argument minimum to 0 so the UI metadata matches the runtime validation.
  • Add a regression test for Bit shift left(-1) returning a clear error message.

Closes #2482.

Testing

  • Red check before fix: Bit shift left(-1) on input a returned \u0000.
  • npx grunt configTests
  • node --no-warnings --no-deprecation --openssl-legacy-provider --trace-uncaught tests/operations/index.mjs
  • npm run lint
  • npm run build
  • git diff --check

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Deepak kudi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@GCHQDeveloper581 GCHQDeveloper581 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same comment applies to your other PRs #2286 and #2496 - though you will only need to address the CLA issues once)

Please could you sign the CLA (and add email address to your account as per CLA note in comments)

Please could you also add an AI disclosure to the PR description - the template added when raising a PR manually is below - we suggest using this format.


AI disclosure
If you have used any AI tools while creating this code, you must declare your usage along with the name of the tools that you used.
Regardless of AI tool usage, you are responsible for any code that you submit, and we expect you to have checked the code and have enough of an understanding of it to answer any questions we might have.


@GCHQDeveloper581

Copy link
Copy Markdown
Contributor

Closing as #2561 enables a better solution, as found in #2586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Bit Shift Left): Negative input produces invalid

3 participants