Skip to content

Fix: Create BigNumber with NaN value in Dish.valid#2571

Open
sivachandran wants to merge 1 commit into
gchq:masterfrom
sivachandran:fix-bignumber-creation
Open

Fix: Create BigNumber with NaN value in Dish.valid#2571
sivachandran wants to merge 1 commit into
gchq:masterfrom
sivachandran:fix-bignumber-creation

Conversation

@sivachandran

@sivachandran sivachandran commented Jun 17, 2026

Copy link
Copy Markdown

Description
The constructor expects the default value but we are not passing it. So it was throwing undefined error. Now passing NaN as default value.

Existing Issue
#2567

Screenshots
image

Console error

Uncaught Error: [BigNumber Error] BigNumber, string, number, or BigInt expected: undefined
    P https://gchq.github.io/CyberChef/assets/main.js:2
    value https://gchq.github.io/CyberChef/assets/main.js:2
    value https://gchq.github.io/CyberChef/assets/main.js:2
    e https://gchq.github.io/CyberChef/assets/main.js:2
    value https://gchq.github.io/CyberChef/assets/main.js:2
    value https://gchq.github.io/CyberChef/assets/main.js:2
    value https://gchq.github.io/CyberChef/assets/main.js:2

AI disclosure
Didn't use AI.

Test Coverage
Added a test.

@sivachandran sivachandran force-pushed the fix-bignumber-creation branch from f2a838c to edeb7ee Compare June 17, 2026 12:10
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sivachandran sivachandran force-pushed the fix-bignumber-creation branch 2 times, most recently from 7eba8d2 to 51b9982 Compare June 17, 2026 12:11
@sivachandran sivachandran changed the title Fix: Create BigNumber with NaN value Fix: Create BigNumber with NaN value in Dish.valid Jun 17, 2026
@sivachandran sivachandran force-pushed the fix-bignumber-creation branch 2 times, most recently from 984bfd1 to 9504caf Compare June 17, 2026 14:31
The constructor expects the default value but we are not passing it.
So it was throwing undefined error. Now passing NaN as default value.
@sivachandran sivachandran force-pushed the fix-bignumber-creation branch from 9504caf to 8feb412 Compare June 18, 2026 04:33
@GCHQDeveloper581 GCHQDeveloper581 linked an issue Jun 18, 2026 that may be closed by this pull request
Comment thread src/core/Dish.mjs
Comment on lines -295 to 299
const temp = new BigNumber();
const temp = new BigNumber(NaN);
temp.c = this.value.c;
temp.e = this.value.e;
temp.s = this.value.s;
this.value = temp;

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.

better still,

this.value = new BigNumber({ s: this.value.s, e: this.value.e, c: this.value.c, _isBigNumber: true});

See

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 report: Sum not working on list of numbers

3 participants