Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-106844: Fix null-bytes handling inLCMapStringEx in_winapi#106857

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
sobolevn wants to merge6 commits intopython:mainfromsobolevn:issue-106844

Conversation

@sobolevn
Copy link
Member

@sobolevnsobolevn commentedJul 18, 2023
edited by bedevere-bot
Loading

_winapi.LCMapStringEx
locale:LPCWSTR
locale:unicode

Choose a reason for hiding this comment

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

Why change it forlocale?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I just backported the solution from927b5af#diff-42415407f8d0ef2d42e29d13d979f633e3543770e62c3871e1101ad532d336a8R1518

So, 3.11 and 3.12 would match.

Choose a reason for hiding this comment

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

The code would be simpler if keep the LPCWSTR converter here.

zooba reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

I agree. We don't need to treat this argument any differently - it's only thesrc argument that requires special handling.

Comment on lines 1567 to 1570
srcLen= (int)srcLenAsSsize;
if (srcLen!=srcLenAsSsize) {
srcLen=-1;
}

Choose a reason for hiding this comment

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

How would it work for large (more than2**32 characters) string containing NUL?

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't, but that's the caller's responsibility.

Choose a reason for hiding this comment

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

LCMapStringEx() will simply return the result for the truncated input. It is bad. How is the caller expected to detect this problem if it only occurs in special circumferences?

What doesLCMapStringEx() return for large input not containing NUL? Most likely it fails. We should either emulate this response (raise an OSError with the same Windows error code) or simply raise an OverflowError.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Please address my comments. If the code in 3.11 has the same flaws, it should be fixed too.

_winapi.LCMapStringEx
locale:LPCWSTR
locale:unicode

Choose a reason for hiding this comment

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

The code would be simpler if keep the LPCWSTR converter here.

zooba reacted with thumbs up emoji
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@serhiy-storchakaserhiy-storchaka added needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsJul 19, 2023
@zooba
Copy link
Member

I don't think the fix is as simple as bringing forward this fix - the underlying code should be identical in current versions, it was just earlier versions that needed a different fix because of existing bugs in the Unicode converters.

I'll take a fresh look and see what ought to happen here. Chances are, updating theLPCWSTR clinic definition makes the most sense.

@zooba
Copy link
Member

Looks like the changes to make argument clinic supportPy_UNICODE_converter actually work when you opt to allow embedded nulls are... complex. I can't figure it out, and pretty sure if I did it'd have wide-ranging effects that we don't want to backport.

Leaving thelocale argument asLPCWSTR should be fine - we only need to handle embedded nulls in thesrc argument.

@zoobazooba removed the needs backport to 3.11only security fixes labelAug 9, 2023
@serhiy-storchaka
Copy link
Member

Opened#107832 for my propositions.

@serhiy-storchaka
Copy link
Member

#107832 fixed also other issues.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@zoobazoobazooba left review comments

@serhiy-storchakaserhiy-storchakaserhiy-storchaka requested changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@sobolevn@bedevere-bot@zooba@serhiy-storchaka

[8]ページ先頭

©2009-2025 Movatter.jp