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

OF-2814: Ensure that multi-byte characters in the XMPP data are parsed properly #2458

Merged

Conversation

guusdk
Copy link
Member

@guusdk guusdk commented Apr 5, 2024

Prioer to this change, parsing errors occurred when multi-byte characters where provided to the parser byte-by-byte (or in byte arrays where a multi-byte character was split over more than one byte array).

This commit re-introduces the fix for this problem that was created under OF-458. It uses a CharsetDecoder that will only read 'enough' bytes from an array, leaving bytes that form an incomplete character in the byte array (to be processed in the next iteration, when hopefully more data was added).

The original fix is refactored a little to account for the different API that is provided by Netty (as compared to the old MINA based code), and to facilitate unit testing (of which a couple are added).

…d properly

Prioer to this change, parsing errors occurred when multi-byte characters where provided to the parser byte-by-byte (or in byte arrays where a multi-byte character was split over more than one byte array).

This commit re-introduces the fix for this problem that was created under OF-458. It uses a CharsetDecoder that will only read 'enough' bytes from an array, leaving bytes that form an incomplete character in the byte array (to be processed in the next iteration, when hopefully more data was added).

The original fix is refactored a little to account for the different API that is provided by Netty (as compared to the old MINA based code), and to facilitate unit testing (of which a couple are added).
@guusdk
Copy link
Member Author

guusdk commented Apr 5, 2024

I've not tested this with an actual XMPP client yet.

@guusdk guusdk added the backport 4.8 on merge, GHA will generate a PR with these changes against 4.8 branch label Jun 28, 2024
@guusdk guusdk merged commit 3a32ce9 into igniterealtime:main Jun 28, 2024
16 checks passed
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 4.8 on merge, GHA will generate a PR with these changes against 4.8 branch
Projects
None yet
1 participant