Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect expressions / assert with side effect in hashtable #85233

Closed
tiran opened this issue Jun 21, 2020 · 3 comments
Closed

Incorrect expressions / assert with side effect in hashtable #85233

tiran opened this issue Jun 21, 2020 · 3 comments
Assignees
Labels
3.9 only security fixes 3.10 only security fixes build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@tiran
Copy link
Member

tiran commented Jun 21, 2020

BPO 41061
Nosy @tiran, @miss-islington
PRs
  • bpo-41061: Fix incorrect expressions in hashtable #21028
  • [3.9] bpo-41061: Fix incorrect expressions in hashtable (GH-21028) #21042
  • 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 = 'https://github.com/tiran'
    closed_at = <Date 2020-10-21.16:49:05.546>
    created_at = <Date 2020-06-21.08:52:57.324>
    labels = ['interpreter-core', 'build', '3.9', '3.10']
    title = 'Incorrect expressions / assert with side effect in hashtable'
    updated_at = <Date 2020-10-21.16:49:05.545>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2020-10-21.16:49:05.545>
    actor = 'christian.heimes'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2020-10-21.16:49:05.546>
    closer = 'christian.heimes'
    components = ['Interpreter Core']
    creation = <Date 2020-06-21.08:52:57.324>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41061
    keywords = ['patch']
    message_count = 3.0
    messages = ['371987', '372038', '372043']
    nosy_count = 2.0
    nosy_names = ['christian.heimes', 'miss-islington']
    pr_nums = ['21028', '21042']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue41061'
    versions = ['Python 3.9', 'Python 3.10']

    @tiran
    Copy link
    Member Author

    tiran commented Jun 21, 2020

    Coverity has found four issues in hashtable implementation and tests

    Py_hashtable_get_entry_generic(_Py_hashtable_t *ht, const void *key)

    CID 1464680 (#1 of 1): Evaluation order violation (EVALUATION_ORDER)write_write_typo: In entry = entry = (_Py_hashtable_entry_t *)((_Py_slist_t *)&ht->buckets[index])->head, entry is written twice with the same value.

    _Py_hashtable_get_entry_ptr(_Py_hashtable_t *ht, const void *key)

    CID 1464602 (#1 of 1): Evaluation order violation (EVALUATION_ORDER)write_write_typo: In entry = entry = (_Py_hashtable_entry_t *)((_Py_slist_t *)&ht->buckets[index])->head, entry is written twice with the same value.

    test_hashtable(PyObject *self, PyObject *Py_UNUSED(args))

    CID 1464668 (#1 of 1): Side effect in assertion (ASSERT_SIDE_EFFECT)assignment_where_comparison_intended: Assignment entry->key = (void *)(uintptr_t)key has a side effect. This code will work differently in a non-debug build.
    CID 1464664 (#1 of 1): Side effect in assertion (ASSERT_SIDE_EFFECT)assignment_where_comparison_intended: Assignment entry->value = (void *)(uintptr_t)(1 + ((int)key - 97)) has a side effect. This code will work differently in a non-debug build.

    @tiran tiran added 3.9 only security fixes 3.10 only security fixes labels Jun 21, 2020
    @tiran tiran self-assigned this Jun 21, 2020
    @tiran tiran added interpreter-core (Objects, Python, Grammar, and Parser dirs) build The build process and cross-build 3.9 only security fixes 3.10 only security fixes labels Jun 21, 2020
    @tiran tiran self-assigned this Jun 21, 2020
    @tiran tiran added interpreter-core (Objects, Python, Grammar, and Parser dirs) build The build process and cross-build labels Jun 21, 2020
    @miss-islington
    Copy link
    Contributor

    New changeset 4901ea9 by Christian Heimes in branch 'master':
    bpo-41061: Fix incorrect expressions in hashtable (GH-21028)
    4901ea9

    @miss-islington
    Copy link
    Contributor

    New changeset f19ed6b by Miss Islington (bot) in branch '3.9':
    bpo-41061: Fix incorrect expressions in hashtable (GH-21028)
    f19ed6b

    @tiran tiran closed this as completed Oct 21, 2020
    @tiran tiran closed this as completed Oct 21, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants