René's URL Explorer Experiment


Title: ctypes: We do not correctly handle NULL dlsym() return values · Issue #126554 · python/cpython · GitHub

Open Graph Title: ctypes: We do not correctly handle NULL dlsym() return values · Issue #126554 · python/cpython

X Title: ctypes: We do not correctly handle NULL dlsym() return values · Issue #126554 · python/cpython

Description: Bug report Bug description: The man(3) page for dlsym() states: In unusual cases (see NOTES) the value of the symbol could actually be NULL. Therefore, a NULL return from dlsym() need not indicate an error. The correct way to distinguish...

Open Graph Description: Bug report Bug description: The man(3) page for dlsym() states: In unusual cases (see NOTES) the value of the symbol could actually be NULL. Therefore, a NULL return from dlsym() need not indicate ...

X Description: Bug report Bug description: The man(3) page for dlsym() states: In unusual cases (see NOTES) the value of the symbol could actually be NULL. Therefore, a NULL return from dlsym() need not indicate ...

Opengraph URL: https://github.com/python/cpython/issues/126554

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ctypes: We do not correctly handle NULL dlsym() return values","articleBody":"# Bug report\n\n### Bug description:\n\nThe man(3) page for `dlsym()` states:\n```\nIn unusual cases (see NOTES) the value of the symbol  could  actually  be\nNULL. Therefore, a NULL return from dlsym() need not indicate an error.\nThe correct way to distinguish an error from a symbol whose value is NULL\nis  to  call  dlerror(3) to clear any old error conditions, then call dl‐\nsym(), and then call dlerror(3) again, saving its  return  value  into  a\nvariable, and check whether this saved value is not NULL.\n```\n\nAs such, there can be cases where a call to `dlsym` returns `NULL`, while no error has been encountered and the string that `dlerror()` returns has not been (re)set.\n\nCurrently, (https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c#L970) we do:\n```C\n\u003c...>\naddress = (void *)dlsym(handle, name);\nif (!address) {\n#ifdef __CYGWIN__\n\u003csnip Windows stuff>\n#else\n        PyErr_SetString(PyExc_ValueError, dlerror());\n\u003c...>\n```\n\nIf `dlsym()` returns `NULL`, then by calling `dlerror()` we pass either `NULL` or a previous, unconsumed error string to `PyErr_SetString`.\n\nIn the context of `ctypes`, a `NULL` return by `dlsym()` might indeed always be considered an error.\n\nTo correctly express this, we should:\n- Call `dlerror()` before `dlsym()`, to clear any previous error\n- Call `dlerror()` after `dlsym()`, to see if `dlsym()` encountered any error\n   - If `dlerror()` returns a non-NULL value, then pass its result to `PyErr_SetString`\n   - If `dlerror()` returns NULL, then check if `address` is NULL, and if so, pass a custom error string to `PyErr_SetString`.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-126555\n* gh-126861\n* gh-127764\n* gh-129872\n* gh-129944\n* gh-129945\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/grgalex","@type":"Person","name":"grgalex"},"datePublished":"2024-11-07T20:17:01Z","url":"https://github.com/python/cpython/issues/126554"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d60166b7-4466-cc6a-69fb-527273d912e5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC298:224815:6D5DAB:8F387C:6B026C05
html-safe-noncec7a9ba0ddc51f682d021ffce05e64ab89e93c4b3dc9655455ade39632e96a67d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjk4OjIyNDgxNTo2RDVEQUI6OEYzODdDOjZCMDI2QzA1IiwidmlzaXRvcl9pZCI6IjM3NTE1NTI4ODcxNTU3NDc4NDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac37842e76e31e86f10f6aa314cc58736ea707c3e8af9798fdf4f1f5a10a5157e0
hovercard-subject-tagissue:2642078584
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/126554/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bd2946aa5f37fafebce5fddcea2382afa913e7edd6d307364c29022545b9f205/python/cpython/issues/126554
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bd2946aa5f37fafebce5fddcea2382afa913e7edd6d307364c29022545b9f205/python/cpython/issues/126554
og:image:altBug report Bug description: The man(3) page for dlsym() states: In unusual cases (see NOTES) the value of the symbol could actually be NULL. Therefore, a NULL return from dlsym() need not indicate ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegrgalex
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/126554#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F126554
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F126554
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/126554
Reloadhttps://github.com/python/cpython/issues/126554
Reloadhttps://github.com/python/cpython/issues/126554
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/126554
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/126554
ctypes: We do not correctly handle NULL dlsym() return valueshttps://github.com/python/cpython/issues/126554#top
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issue-2642078584
https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c#L970https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c#L970
gh-126554: ctypes: Correctly handle NULL dlsym values #126555https://github.com/python/cpython/pull/126555
[3.13] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555) #126861https://github.com/python/cpython/pull/126861
[3.12] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555) #127764https://github.com/python/cpython/pull/127764
gh-126554: correct detection of gcc for TestNullDlsym.test_null_dlsym #129872https://github.com/python/cpython/pull/129872
[3.13] gh-126554: correct detection of gcc for TestNullDlsym.test_null_dlsym (GH-129872) #129944https://github.com/python/cpython/pull/129944
[3.12] gh-126554: correct detection of gcc for TestNullDlsym.test_null_dlsym (GH-129872) #129945https://github.com/python/cpython/pull/129945
grgalexhttps://github.com/grgalex
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Nov 7, 2024https://github.com/python/cpython/issues/126554#event-15192138205
https://github.com/efimov-mikhail
efimov-mikhailhttps://github.com/efimov-mikhail
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issuecomment-2463180623
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issuecomment-2463220536
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issuecomment-2463266531
https://stackoverflow.com/a/53590014https://stackoverflow.com/a/53590014
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issuecomment-2463273152
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issuecomment-2463278438
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 7, 2024https://github.com/python/cpython/issues/126554#issuecomment-2463285850
@efimov-mikhailhttps://github.com/efimov-mikhail
ZeroIntensityhttps://github.com/ZeroIntensity
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
on Nov 7, 2024https://github.com/python/cpython/issues/126554#event-15194641806
https://github.com/grgalex
grgalexhttps://github.com/grgalex
on Nov 8, 2024https://github.com/python/cpython/issues/126554#issuecomment-2464838209
https://en.wikipedia.org/wiki/Michael_Kerriskhttps://en.wikipedia.org/wiki/Michael_Kerrisk
encukouhttps://github.com/encukou
on Nov 15, 2024https://github.com/python/cpython/issues/126554#event-15310315490
gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555)https://github.com/python/cpython/commit/8717f792f7cc343599dc60daf80630cceb66145b
gh-126554https://github.com/python/cpython/issues/126554
GH-126555https://github.com/python/cpython/pull/126555
8717f79https://github.com/python/cpython/commit/8717f792f7cc343599dc60daf80630cceb66145b
miss-islingtonhttps://github.com/miss-islington
on Nov 15, 2024https://github.com/python/cpython/issues/126554#event-15310318766
pythongh-126554: ctypes: Correctly handle NULL dlsym values (pythonGH…https://github.com/miss-islington/cpython/commit/5b4116ef103b58c0941777bccb10793c1ec81f84
pythongh-126554https://github.com/python/cpython/issues/126554
pythonGH…https://github.com/python/cpython/pull/126555
5b4116ehttps://github.com/miss-islington/cpython/commit/5b4116ef103b58c0941777bccb10793c1ec81f84
https://github.com/encukou
encukouhttps://github.com/encukou
on Nov 15, 2024https://github.com/python/cpython/issues/126554#issuecomment-2478491696
@grgalexhttps://github.com/grgalex
@ZeroIntensityhttps://github.com/ZeroIntensity
@picnixzhttps://github.com/picnixz
ambvhttps://github.com/ambv
on Nov 17, 2024https://github.com/python/cpython/issues/126554#event-15325620488
[3.13] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555…https://github.com/python/cpython/commit/52efb95b4527617633c43158c8b73e1c985f28fb
gh-126554https://github.com/python/cpython/issues/126554
GH-126555https://github.com/python/cpython/pull/126555
52efb95https://github.com/python/cpython/commit/52efb95b4527617633c43158c8b73e1c985f28fb
picnixzhttps://github.com/picnixz
on Dec 8, 2024https://github.com/python/cpython/issues/126554#event-15572739694
pythongh-126554: ctypes: Correctly handle NULL dlsym values (pythonGH…https://github.com/picnixz/cpython/commit/583e01aa303bcd33a29bd4d875b0f69645b3bef7
pythongh-126554https://github.com/python/cpython/issues/126554
pythonGH…https://github.com/python/cpython/pull/126555
583e01ahttps://github.com/picnixz/cpython/commit/583e01aa303bcd33a29bd4d875b0f69645b3bef7
encukouhttps://github.com/encukou
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Dec 9, 2024https://github.com/python/cpython/issues/126554#event-15582591692
serhiy-storchakahttps://github.com/serhiy-storchaka
on Dec 17, 2024https://github.com/python/cpython/issues/126554#event-15684850317
[3.12] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555…https://github.com/python/cpython/commit/6ac578cf535666283c95dff17d70e4d7de0150e7
gh-126554https://github.com/python/cpython/issues/126554
GH-126555https://github.com/python/cpython/pull/126555
6ac578chttps://github.com/python/cpython/commit/6ac578cf535666283c95dff17d70e4d7de0150e7
ebonnalhttps://github.com/ebonnal
on Jan 12, 2025https://github.com/python/cpython/issues/126554#event-15894561392
pythongh-126554: ctypes: Correctly handle NULL dlsym values (pythonGH…https://github.com/ebonnal/cpython/commit/1a7fa4b728a679dd807fd97f4ece7745494b62a8
pythongh-126554https://github.com/python/cpython/issues/126554
pythonGH…https://github.com/python/cpython/pull/126555
1a7fa4bhttps://github.com/ebonnal/cpython/commit/1a7fa4b728a679dd807fd97f4ece7745494b62a8
encukouhttps://github.com/encukou
on Feb 10, 2025https://github.com/python/cpython/issues/126554#event-16244634935
gh-126554: correct detection of `gcc` for `TestNullDlsym.test_null_dl…https://github.com/python/cpython/commit/978211c8a8646b050a8d687ca720f934fcce112c
gh-126554https://github.com/python/cpython/issues/126554
978211chttps://github.com/python/cpython/commit/978211c8a8646b050a8d687ca720f934fcce112c
miss-islingtonhttps://github.com/miss-islington
on Feb 10, 2025https://github.com/python/cpython/issues/126554#event-16244640404
pythongh-126554: correct detection of `gcc` for `TestNullDlsym.test_n…https://github.com/miss-islington/cpython/commit/b9f834658d136b24229d8e992a86225783fdfa2c
pythongh-126554https://github.com/python/cpython/issues/126554
b9f8346https://github.com/miss-islington/cpython/commit/b9f834658d136b24229d8e992a86225783fdfa2c
pythongh-126554: correct detection of `gcc` for `TestNullDlsym.test_n…https://github.com/miss-islington/cpython/commit/c3994fa7aa5ab40b120c733efa987ad862c8a4d1
pythongh-126554https://github.com/python/cpython/issues/126554
c3994fahttps://github.com/miss-islington/cpython/commit/c3994fa7aa5ab40b120c733efa987ad862c8a4d1
picnixzhttps://github.com/picnixz
on Feb 10, 2025https://github.com/python/cpython/issues/126554#event-16244882364
[3.12] gh-126554: correct detection of `gcc` for `TestNullDlsym.test_…https://github.com/python/cpython/commit/3d2ca741dc66ebcd30cee61a2e77249cb3c57f72
gh-126554https://github.com/python/cpython/issues/126554
3d2ca74https://github.com/python/cpython/commit/3d2ca741dc66ebcd30cee61a2e77249cb3c57f72
[3.13] gh-126554: correct detection of `gcc` for `TestNullDlsym.test_…https://github.com/python/cpython/commit/cef406bbc3a35d487763e1a4ea075f1fcfa5497d
gh-126554https://github.com/python/cpython/issues/126554
cef406bhttps://github.com/python/cpython/commit/cef406bbc3a35d487763e1a4ea075f1fcfa5497d
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/126554
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/126554
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.