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 ConvertAndFreeCoTaskMemString for 32 bit platforms #277

Merged
merged 1 commit into from
Aug 16, 2018

Conversation

jiria
Copy link
Member

@jiria jiria commented Aug 3, 2018

This is submitted on behalf of askariv.

Based on align.go line 367:
if Widthptr == 4 && w != int64(int32(w)) {
yyerror("type %v too large”, t)
}
The idea in this case is to convert to a slice of a large array of uint16s so it can be used with practically any size of a string, since ‘func UTF16ToString(s []uint16) string’.
The original code had [1<<30] of uint16 elemets which make the width 1 << 31 or 2147483648 (0x80000000) meaning -2147483648 in 32bit!
This is why [1<<29] works, and it is large enough for any real purpose, after all it is a string.

Please let us know if you have a better idea on how to do the type cast.

@jterry75 jterry75 requested a review from jstarks August 6, 2018 20:14
@jterry75
Copy link
Contributor

jterry75 commented Aug 6, 2018

LGTM. @jstarks would know if this is the best fix but I think it works.

@jstarks jstarks merged commit 573060c into microsoft:master Aug 16, 2018
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

3 participants