python / cpython

The Python programming language
https://www.python.org
Other
63.42k stars 30.37k forks source link

Unchecked return in Objects/typeobject.c and possible uninitialized variables in cls and new_mro #86200

Closed 74f5b193-9df3-45ae-ad46-98b6ea8595f5 closed 2 years ago

74f5b193-9df3-45ae-ad46-98b6ea8595f5 commented 4 years ago
BPO 42034
Nosy @serhiy-storchaka
PRs
  • python/cpython#22695
  • 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: ```python assignee = None closed_at = None created_at = labels = ['type-feature', 'library'] title = 'Unchecked return in Objects/typeobject.c and possible uninitialized variables in cls and new_mro' updated_at = user = 'https://bugs.python.org/monocle-ai' ``` bugs.python.org fields: ```python activity = actor = 'serhiy.storchaka' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'monocle-ai' dependencies = [] files = [] hgrepos = [] issue_num = 42034 keywords = ['patch'] message_count = 3.0 messages = ['378615', '379784', '403547'] nosy_count = 3.0 nosy_names = ['python-dev', 'serhiy.storchaka', 'monocle-ai'] pr_nums = ['22695'] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue42034' versions = [] ```

    74f5b193-9df3-45ae-ad46-98b6ea8595f5 commented 4 years ago

    The return value of a function that is potentially used to initialize a local variable is not checked. Therefore, reading the local variable may result in undefined behavior.

    Our AI analyzer found that this function is called for a total of 43 times. Out of these 43 times, the return value from the function call is checked at 42 instances. This is the only instance where the code misses to check the return value for success or failure.

    Once such correct reference usage found in Python/hamt.c at line 2805 .

    74f5b193-9df3-45ae-ad46-98b6ea8595f5 commented 4 years ago

    Bumping this up for updates.

    serhiy-storchaka commented 3 years ago

    There is no bug in this code. The list "temp" contains only 2- and 3-tuples. PyArg_UnpackTuple() never fails.