Skip to content

Fix integer conversion precision loss on JRuby 10#178

Merged
donoghuc merged 2 commits intologstash-plugins:mainfrom
donoghuc:jruby-10
Mar 26, 2026
Merged

Fix integer conversion precision loss on JRuby 10#178
donoghuc merged 2 commits intologstash-plugins:mainfrom
donoghuc:jruby-10

Conversation

@donoghuc
Copy link
Copy Markdown
Contributor

parse_signed_hex_str applied Float() to all strings when JRuby 10's Float() gained signed hex support. This truncated values beyond 2^53. Restrict the Float() to hex strings only.

Also use BigDecimal for float-string-to-integer conversion and declare bigdecimal as a runtime gem dependency for JRuby 10.

Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/

Closes: #177

`parse_signed_hex_str` applied `Float()` to all strings when JRuby 10's
`Float()` gained signed hex support. This truncated values beyond 2^53.
Restrict the `Float()` to hex strings only.

Also use BigDecimal for float-string-to-integer conversion and declare
bigdecimal as a runtime gem dependency for JRuby 10.
Copy link
Copy Markdown
Member

@robbavey robbavey left a comment

Choose a reason for hiding this comment

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

LGTM

@donoghuc donoghuc merged commit e76abba into logstash-plugins:main Mar 26, 2026
3 checks passed
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.

Fix convert_integer to avoid Float intermediation for large numbers

2 participants