Skip to content

Handle invalid View Bit Plane colour input#2588

Open
KairosOps wants to merge 1 commit into
gchq:masterfrom
KairosOps:fix/validate-view-bit-plane-colour
Open

Handle invalid View Bit Plane colour input#2588
KairosOps wants to merge 1 commit into
gchq:masterfrom
KairosOps:fix/validate-view-bit-plane-colour

Conversation

@KairosOps

Copy link
Copy Markdown

Fixes #2503.

View Bit Plane assumed the colour argument always matched one of the RGBA channel names. A pretty URL such as View_Bit_Plane('',7) leaves that argument as an empty string, so the operation ended up reading from an invalid pixel offset instead of reporting a bad argument.

This adds an explicit colour lookup check before scanning the image and returns the same kind of user-facing OperationError that the operation already uses for invalid bit numbers. I also added a regression test using the empty colour argument from the failing URL path.

Checked locally:

  • targeted View Bit Plane operation tests
  • direct pretty-URL parse/bake check for View_Bit_Plane('',7)
  • npx grunt configTests
  • node --check src/core/operations/ViewBitPlane.mjs
  • node --check tests/operations/tests/Image.mjs
  • git diff --check

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.

bug(View Bit Plane): TypeError can't access property "toString" of undefined

1 participant