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

Fix a bad cast to char * that causes incorrect results on big endian. #196

Merged
merged 2 commits into from Oct 31, 2023

Conversation

millert
Copy link
Contributor

@millert millert commented Sep 18, 2023

Now that awk stores chars as int we need to cast the Node * to int *.

Fixes the following script on big endian CPUs.

BEGIN { work="K"; gsub("[x]", "J", work); print work; }

Before fix:

JKJ

After:

K

Thanks to George Koehler for simplifying the test case.

@millert millert changed the base branch from master to staging September 18, 2023 23:37
Now that awk stores chars as int we need to cast the Node * to int *.
We need to store a UTF-32 string, not a UTF-8 string, for consistency
with the other CCL code.  Fixes an out-of-bounds read of an empty
CCL.
@plan9
Copy link
Collaborator

plan9 commented Sep 22, 2023

thanks todd, appreciated.

@plan9 plan9 merged commit 9666b77 into onetrueawk:staging Oct 31, 2023
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.

None yet

2 participants