Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

socket.setblocking(x) treats multiples of 2**32 as False #79372

Closed

Description

@izbyshev
mannequin
BPO 35191
Nosy @vstinner, @serhiy-storchaka, @izbyshev
PRs
  • [3.11] bpo-35191: Fix unexpected integer truncation in socket.setblocking() #10415
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2018-11-08.15:43:43.083>
    labels = ['extension-modules', '3.8', 'type-bug', '3.7']
    title = 'socket.setblocking(x) treats multiples of 2**32 as False'
    updated_at = <Date 2018-11-08.15:46:37.663>
    user = 'https://github.com/izbyshev'

    bugs.python.org fields:

    activity = <Date 2018-11-08.15:46:37.663>
    actor = 'izbyshev'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2018-11-08.15:43:43.083>
    creator = 'izbyshev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35191
    keywords = ['patch']
    message_count = 1.0
    messages = ['329478']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'izbyshev']
    pr_nums = ['10415']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35191'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    Activity

    1. izbyshev commented on Nov 8, 2018

      izbyshevmannequin
      MannequinAuthor

      UBSAN with -fsanitize=implicit-integer-truncation reported a suspicious case:

      testSetBlocking_overflow (test.test_socket.NonBlockingTCPTests) ... /scratch2/izbyshev/cpython/Modules/socketmodule.c:2688:33: runtime error: implicit conversion from type 'long' of value 4294967296 (64-bit, signed) to type 'int' changed the value to 0 (32-bit, signed)

      It turned out that sock_setblocking() converts its (logically boolean) argument to long, but then passes it to internal_setblocking() which accepts int (

      if (internal_setblocking(s, block) == -1) {
      ). This results in unexpected truncation on platforms with 64-bit long.

      testSetBlocking_overflow() which is supposed to check this doesn't work because it only checks socket timeout which is updated correctly. However, the actual state of socket descriptor is changed to the opposite value (non-blocking) in this case.

    2. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of life3.8 (EOL)end of lifeextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions