Skip to content

Fix undefined behavior for infinite array indices#3534

Open
MAXDVVV wants to merge 1 commit into
jqlang:masterfrom
MAXDVVV:fix-infinite-array-index-ub
Open

Fix undefined behavior for infinite array indices#3534
MAXDVVV wants to merge 1 commit into
jqlang:masterfrom
MAXDVVV:fix-infinite-array-index-ub

Conversation

@MAXDVVV
Copy link
Copy Markdown

@MAXDVVV MAXDVVV commented Apr 29, 2026

Fixes #3533.

This avoids undefined behavior when array indices are non-finite numbers.

Changes:

  • treat non-finite numeric array keys as missing for has()
  • ignore non-finite numeric array keys for del()
  • clamp finite numeric indices before converting them to int
  • add regression coverage for has(infinite) and del(.[infinite])

Validation:

  • 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.

undefined behavior in array index handling for infinite

1 participant