GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.11] bpo-35191: Fix unexpected integer truncation in socket.setblocking() by izbyshev · Pull Request #10415 · python/cpython

Conversation

@izbyshev

@izbyshev izbyshev commented Nov 8, 2018 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

On platforms with 64-bit long, socket.setblocking(x) treated all x
which lower 32 bits are zero as False due to integer truncation.

Reported by ubsan.

https://bugs.python.org/issue35191

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 8, 2018
@bedevere-bot bedevere-bot added the awaiting review label Nov 8, 2018
vstinner
vstinner reviewed Nov 8, 2018
View reviewed changes
Comment thread Modules/socketmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner
vstinner reviewed Nov 8, 2018
View reviewed changes
Comment thread Lib/test/test_socket.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka reviewed Nov 8, 2018
View reviewed changes
Comment thread Modules/socketmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@benjaminp

benjaminp commented Sep 10, 2019

Copy link
Copy Markdown
Contributor

It seems like we could further and make the block argument to internal_setblocking a real C bool.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@serhiy-storchaka

serhiy-storchaka commented Dec 1, 2023

Copy link
Copy Markdown
Member

It was fixed in #15609. PyObject_IsTrue() is now used instead of PyLong_AsLong().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Alexey Izbyshev added 3 commits December 1, 2023 14:58
Alexey Izbyshev @serhiy-storchaka
bpo-35191: Fix unexpected integer truncation in socket.setblocking()
972ffb9
On platforms with 64-bit long, socket.setblocking(x) treated all x
which lower 32 bits are zero as False due to integer truncation.

Reported by ubsan.
Alexey Izbyshev @serhiy-storchaka
Use a separate int variable for the block flag
8e70262
Alexey Izbyshev @serhiy-storchaka
Fix NEWS
cda490b
@serhiy-storchaka
serhiy-storchaka force-pushed the bpo-35191 branch from 72036ce to cda490b Compare December 1, 2023 12:59
@serhiy-storchaka
serhiy-storchaka requested review from a team, AlexWaygood, FFY00, JelleZijlstra, barneygale, berkerpeksag, brettcannon, cjw296, corona10, encukou, ericvsmith, erlend-aasland, ethanfurman, gpshead, hauntsaninja, rhettinger and terryjreedy as code owners December 1, 2023 12:59
@serhiy-storchaka
serhiy-storchaka removed request for a team, 1st1, JelleZijlstra, abalkin, asvetlov, barneygale, berkerpeksag, brettcannon, cjw296, encukou, ericsnowcurrently, ericvsmith, gpshead, hugovk, iritkatriel, jaraco, methane, ncoghlan, pganssle, tiran, vsajip and warsaw December 1, 2023 13:02
@serhiy-storchaka

serhiy-storchaka commented Dec 1, 2023

Copy link
Copy Markdown
Member

Rebased on 3.11 which still is not fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Dec 1, 2023

Copy link
Copy Markdown
Member

@serhiy-storchaka: Maybe you made a mistake, since suddenly, the change started to change 1723 files :-D

This PR is for the 3.11 branch. Maybe a new PR for the main branch should be written instead?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka approved these changes Dec 1, 2023
View reviewed changes
vstinner
vstinner reviewed Dec 1, 2023
View reviewed changes
Comment thread Lib/test/test_socket.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka added 2 commits December 1, 2023 15:34
@serhiy-storchaka
Fix tests.
0349f63
@serhiy-storchaka
Update 2018-11-08-18-44-04.bpo-35191.s29bWu.rst
af2e05a
vstinner
vstinner approved these changes Dec 1, 2023
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@izbyshev izbyshev mannequin mentioned this pull request Apr 10, 2022
socket.setblocking(x) treats multiples of 2**32 as False #79372
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@izbyshev @benjaminp @serhiy-storchaka @vstinner @the-knights-who-say-ni @ezio-melotti @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.