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 — Incorrect error handling for APIs that can raise exceptions · Issue #105375 · python/cpython

Incorrect error handling for APIs that can raise exceptions #105375

New issue
Copy link
New issue
Copy link
Closed
Closed
Incorrect error handling for APIs that can raise exceptions#105375
#105610 (+9)
Copy link
Assignees
erlend-aasland
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixestopic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@erlend-aasland
erlend-aasland
opened on Jun 6, 2023
Issue body actions

For example, in the collation callback two str objects (string1 and string2) are created using PyUnicode_FromStringAndSize. Error handling should happen directly after each call to PyUnicode_FromStringAndSize:

cpython/Modules/_sqlite/connection.c

Lines 1870 to 1875 in 0cb6b9b

string1 = PyUnicode_FromStringAndSize((const char*)text1_data, text1_length);
string2 = PyUnicode_FromStringAndSize((const char*)text2_data, text2_length);
if (!string1 || !string2) {
goto finally; /* failed to allocate strings */
}

Other cases where error handling is not done immediately after the API has been used:

  • gh-105375: Improve error handling in PyUnicode_BuildEncodingMap() #105491
  • gh-105375: Improve error handling in compiler_enter_scope() #105494
  • gh-105375: Improve error handling in the builtins extension module #105585
  • gh-105375: Improve errnomodule error handling #105590
  • gh-105375: Improve error handling in _elementtree #105591
  • gh-105375: Improve posix error handling #105592
  • gh-105375: Improve error handling in _ctypes #105593
  • gh-105375: Improve array.array exception handling #105594
  • gh-105375: Improve error handling in _Unpickler_SetInputStream() #105667
  • gh-105375: Improve _pickle error handling #105475
  • gh-105375: Harden _ssl initialisation #105599
  • gh-105375: Improve error handling in zoneinfo module #105586
  • gh-105375: Harden _datetime initialisation #105604
  • gh-105375: Harden pyexpat initialisation #105606
  • gh-105375: Improve _decimal error handling #105605
  • gh-105375: Harden error handling in _testcapi/heaptype.c #105608
  • gh-105375: Improve PyErr_WarnExplicit() error handling #105610
  • gh-105375: Improve error handling in the sys extension module #105611

I might have missed some; I did not do a complete audit yet.

Linked PRs

  • gh-105375: Improve error handling in sqlite3 collation callback #105412
  • [3.12] gh-105375: Improve error handling in sqlite3 collation callback (GH-105412) #105440
  • [3.11] gh-105375: Improve error handling in sqlite3 collation callback (GH-105412) #105441
  • gh-105375: Improve _pickle error handling #105475
  • gh-105375: Improve error handling in PyUnicode_BuildEncodingMap() #105491
  • gh-105375: Improve error handling in compiler_enter_scope() #105494
  • [3.12] gh-105375: Improve error handling in compiler_enter_scope() (GH-105494) #105581
  • [3.11] gh-105375: Improve error handling in compiler_enter_scope() (#105494) #105582
  • [3.11] gh-105375: Improve _pickle error handling (#105475) #105583
  • [3.12] gh-105375: Improve _pickle error handling (#105475) #105584
  • gh-105375: Improve error handling in the builtins extension module #105585
  • gh-105375: Improve error handling in zoneinfo module #105586
  • gh-105375: Improve errnomodule error handling #105590
  • gh-105375: Improve error handling in _elementtree #105591
  • gh-105375: Improve posix error handling #105592
  • gh-105375: Improve error handling in _ctypes #105593
  • gh-105375: Improve array.array exception handling #105594
  • [3.12] gh-105375: Improve errnomodule error handling (#105590) #105596
  • [3.11] gh-105375: Improve posix error handling (GH-105592) #105597
  • [3.12] gh-105375: Improve posix error handling (GH-105592) #105598
  • gh-105375: Harden _ssl initialisation #105599
  • [3.12] gh-105375: Improve error handling in _elementtree (GH-105591) #105600
  • [3.11] gh-105375: Improve error handling in _elementtree (GH-105591) #105601
  • gh-105375: Harden _datetime initialisation #105604
  • gh-105375: Improve _decimal error handling #105605
  • gh-105375: Harden error handling in _testcapi/heaptype.c #105608
  • gh-105375: Improve PyErr_WarnExplicit() error handling #105610
  • gh-105375: Improve error handling in the sys extension module #105611
  • [3.12] gh-105375: Improve error handling in zoneinfo module (GH-105586) #105612
  • [3.11] gh-105375: Improve error handling in zoneinfo module (GH-105586) #105613
  • [3.12] gh-105375: Harden error handling in _testcapi/heaptype.c (GH-105608) #105615
  • [3.12] gh-105375: Harden _ssl initialisation (GH-105599) #105642
  • [3.11] gh-105375: Improve array.array exception handling (GH-105594) #105643
  • [3.12] gh-105375: Improve array.array exception handling (GH-105594) #105644
  • [3.12] gh-105375: Harden _datetime initialisation (GH-105604) #105645
  • [3.11] gh-105375: Harden _datetime initialisation (GH-105604) #105646
  • [3.12] gh-105375: Improve _decimal error handling (GH-105605) #105647
  • [3.11] gh-105375: Improve _decimal error handling (GH-105605) #105648
  • [3.12] gh-105375: Improve error handling in the builtins extension module (GH-105585) #105649
  • [3.11] gh-105375: Improve error handling in the builtins extension module (GH-105585) #105650
  • [3.11] gh-105375: Harden _ssl initialisation (#105599) #105651
  • [3.12] gh-105375: Improve PyErr_WarnExplicit() error handling (GH-105610) #105659
  • [3.11] gh-105375: Improve PyErr_WarnExplicit() error handling (GH-105610) #105660
  • [3.12] gh-105375: Improve error handling in PyUnicode_BuildEncodingMap() (GH-105491) #105661
  • [3.11] gh-105375: Improve error handling in PyUnicode_BuildEncodingMap() (GH-105491) #105662
  • [3.12] gh-105375: Improve error handling in _ctypes (GH-105593) #105663
  • [3.11] gh-105375: Improve error handling in _ctypes (GH-105593) #105664
  • [3.12] gh-105375: Improve error handling in the sys extension module (GH-105611) #105665
  • [3.11] gh-105375: Improve error handling in the sys extension module (#105611) #105666
  • gh-105375: Improve error handling in _Unpickler_SetInputStream() #105667
  • [3.11] gh-105375: Harden pyexpat initialisation (#105606) #105668
  • [3.12] gh-105375: Harden pyexpat initialisation (#105606) #105669
  • gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields #105686
  • [3.12] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields (GH-105686) #105710
  • [3.11] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields (#105686) #105711
  • [3.12] gh-105375: Improve error handling in _Unpickler_SetInputStream() (#105667) #105720
  • [3.11] gh-105375: Improve error handling in _Unpickler_SetInputStream() (#105667) #105721

Activity

Next
  1. erlend-aasland
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 6, 2023
  2. erlend-aasland
    self-assigned this
    on Jun 6, 2023
  3. erlend-aasland commented on Jun 6, 2023

    @erlend-aasland
    erlend-aasland
    on Jun 6, 2023 · Hidden as outdated
    Author
    show commentMore actions
  4. AlexWaygood
    added
    topic-sqlite3
    on Jun 6, 2023
  5. erlend-aasland
    added a commit that references this issue on Jun 6, 2023

    pythongh-105375: Improve error handling in sqlite3 collation callback

    5429c38
  6. erlend-aasland
    linked a pull request that will close this issuegh-105375: Improve error handling in sqlite3 collation callback #105412on Jun 6, 2023
  7. erlend-aasland
    closed this as completedin #105412on Jun 7, 2023
  8. erlend-aasland
    added a commit that references this issue on Jun 7, 2023

    gh-105375: Improve error handling in sqlite3 collation callback (#105412

    a24a780
  9. miss-islington
    added 2 commits that reference this issue on Jun 7, 2023

    pythongh-105375: Improve error handling in sqlite3 collation callback (…

    350dfe5

    pythongh-105375: Improve error handling in sqlite3 collation callback (…

    4da6297
  10. erlend-aasland
    changed the title [-]Incorrect error handling in sqlite3 collation callback[/-] [+]Missing error handling for APIs that can raise exceptions[/+] on Jun 7, 2023
  11. erlend-aasland
    changed the title [-]Missing error handling for APIs that can raise exceptions[/-] [+]Incorrect error handling for APIs that can raise exceptions[/+] on Jun 7, 2023
  12. erlend-aasland
    added a commit that references this issue on Jun 7, 2023

    [3.12] gh-105375: Improve error handling in sqlite3 collation callback (

    bb6ea72
  13. erlend-aasland
    reopened this on Jun 7, 2023
  14. erlend-aasland
    added
    topic-C-API
    on Jun 7, 2023
  15. 126 remaining items

  16. erlend-aasland
    added a commit that references this issue on Jun 12, 2023

    [3.12] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object…

    017b959
  17. carljm
    added a commit that references this issue on Jun 12, 2023

    Merge branch 'main' into modulelocals

    2fae889
  18. kumaraditya303
    added a commit that references this issue on Jun 13, 2023

    [3.11] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object…

    36c393c
  19. erlend-aasland
    added 3 commits that reference this issue on Jun 13, 2023

    gh-105375: Improve error handling in _Unpickler_SetInputStream() (#10…

    217589d

    [3.12] pythongh-105375: Improve error handling in _Unpickler_SetInput…

    3cfb1cf

    [3.11] pythongh-105375: Improve error handling in _Unpickler_SetInput…

    c43310d
  20. erlend-aasland
    closed this as completedon Jun 13, 2023
  21. erlend-aasland
    added 2 commits that reference this issue on Jun 13, 2023

    [3.11] gh-105375: Improve error handling in _Unpickler_SetInputStream…

    2b1745f

    [3.12] gh-105375: Improve error handling in _Unpickler_SetInputStream…

    56877e4
  22. bbannier
    added a commit that references this issue on May 8, 2024

    Do not assume that binary addresses are valid unicode

    d3e0afd
  23. timwoj
    added a commit that references this issue on May 8, 2024

    Do not assume that binary addresses are valid unicode

    d61edb0
  24. freebsd-git
    added a commit that references this issue on Jun 19, 2024

    security/zeek: Fix intermittent crash

    20f7942
  25. timwoj
    added a commit that references this issue on Jul 31, 2024

    Do not assume that binary addresses are valid unicode

    58cae28
  26. camachat
    added 2 commits that reference this issue on Jul 22, 2026

    security/zeek: Fix intermittent crash

    f9996b7

    security/zeek: Fix intermittent crash

    88774d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @erlend-aasland
    erlend-aasland

Labels

3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixestopic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — 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.