Skip to content

Fix JS_ReadString for wide strings on big endian targets #354

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

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

chqrlie
Copy link
Collaborator

@chqrlie chqrlie commented Apr 7, 2024

wide characters are stored in little endian order, so they must be swapped when read in a big endian target

Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

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

Any chance of a test?

@chqrlie
Copy link
Collaborator Author

chqrlie commented Apr 7, 2024

Any chance of a test?

To test the serialization of strings:

  • use a wide character in example/hello.js and check for its presence at runtime when running the executable

More generally:

  • we could test the serialization on both little-endian and big-endian systems passing data to workers.

@chqrlie
Copy link
Collaborator Author

chqrlie commented Apr 8, 2024

I am going to merge this patch. Adding a test requires a better understanding of the CI tests and the cmake stuff, so I am not the best candidate for this.

@chqrlie chqrlie merged commit 56593f4 into quickjs-ng:master Apr 8, 2024
@chqrlie chqrlie deleted the fix-js-readstring branch April 8, 2024 15:02
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.

2 participants