Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIxing WritableBytesConverter to not overwrite bytes with wrong value #2075

Merged

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented Mar 30, 2023

This fixes two bugs in WritableBytesConverter::convert:

  1. If the from is a BytesWritable then we first correctly copy its bytes to to in SafeWritableConverter, and then we incorrectly copy the bytes for the string representation of the byte array into to in JdkBytesConverter (so a performance problem plus the wrong data in to).
  2. If the from is a Text then we first correctly copy its bytes to to in SafeWritableConverter, and then we incorrectly copy the string value of from into a byte array that might be larger than expected in JdkBytesConverter (so a performance problem plus a result array in to that is too large).

It looks like this was caused by #937

Closes #2072

Copy link
Member

@jbaiera jbaiera left a comment

Choose a reason for hiding this comment

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

LGTM!

@masseyke masseyke merged commit 95fd310 into elastic:main Apr 13, 2023
@masseyke masseyke deleted the fix/WritableBytesConverter-overwrites-bytes branch April 13, 2023 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WritableBytesConverter always falls back to JdkBytesConverter
2 participants