Skip to content

fix(ast): avoid panic in ConstantNode.String on non-JSON floats#974

Open
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:constantnode-string-nan-panic
Open

fix(ast): avoid panic in ConstantNode.String on non-JSON floats#974
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:constantnode-string-nan-panic

Conversation

@netliomax25-code
Copy link
Copy Markdown

ConstantNode.String panics when json.Marshal rejects the value, which happens for NaN and ±Inf. Constant folding produces these for array literals like [0/0], and predicateCombination calls String on the collection argument while optimizing, so any([0/0], # > 0) || any([0/0], # > 0) makes expr.Compile panic instead of returning a program. Compile does not recover, so the panic reaches the host. Fall back to fmt for values json cannot encode.

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.

1 participant