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-96821: Fix undefined behaviour inaudioop.c#96923

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

Merged

Conversation

matthiasgoergens
Copy link
Contributor

@matthiasgoergensmatthiasgoergens commentedSep 19, 2022
edited
Loading

Left-shifting negative numbers is undefined behaviour.

Fortunately, multiplication works just as well, is (implementation) defined behaviour, and gets compiled to the same machine code as before by optimizing compilers.

Left-shifting negative numbers is undefined behaviour.Fortunately, multiplication works just as well, is defined behaviour,and gets compiled to the same machine code as before by optimizingcompilers.
@matthiasgoergens
Copy link
ContributorAuthor

matthiasgoergens commentedSep 19, 2022
edited
Loading

@kumaraditya303@mdickinson@erlend-aasland Would you please have a look? Thanks!

@kumaraditya303
Copy link
Contributor

kumaraditya303 commentedSep 26, 2022
edited
Loading

Sorry but I won't have time for this in the near future, Mark or Erlend can take a look.

Copy link
Member

@mdickinsonmdickinson left a comment

Choose a reason for hiding this comment

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

The changes LGTM at least in principle; I haven't done much in the way of testing.

@mdickinson
Copy link
Member

@matthiasgoergens Can we revert the changes at lines 173 and 262 of the original code? I'm fairly sure that those changes aren't necessary, because the quantity being shifted is always nonnegative.

@mdickinson
Copy link
Member

Can we revert the changes at lines 173 and 262 of the original code?

To be clear, I'm happy with the rest of the changes as-is, so if@JelleZijlstra is also happy, I think we can merge after those two reversions.

@matthiasgoergens
Copy link
ContributorAuthor

@mdickinson Thanks. I'll revert the lines you asked about.

@matthiasgoergens
Copy link
ContributorAuthor

matthiasgoergens commentedOct 9, 2022
edited
Loading

@mdickinson@JelleZijlstra I applied the suggested changes.

Thanks for having a look!

mdickinson reacted with thumbs up emoji

@mdickinsonmdickinson merged commit553d3c1 intopython:mainOct 10, 2022
mpage pushed a commit to mpage/cpython that referenced this pull requestOct 11, 2022
*pythongh-96821: Fix undefined behaviour in `audioop.c`Left-shifting negative numbers is undefined behaviour.Fortunately, multiplication works just as well, is defined behaviour,and gets compiled to the same machine code as before by optimizingcompilers.Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mdickinsonmdickinsonmdickinson approved these changes

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@matthiasgoergens@kumaraditya303@mdickinson@JelleZijlstra@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp