Title: Fix(LDAPObject): Prevent search attrlist memory error by jkoeniger · Pull Request #555 · python-ldap/python-ldap · GitHub
Open Graph Title: Fix(LDAPObject): Prevent search attrlist memory error by jkoeniger · Pull Request #555 · python-ldap/python-ldap
X Title: Fix(LDAPObject): Prevent search attrlist memory error by jkoeniger · Pull Request #555 · python-ldap/python-ldap
Description: Problem Providing a dictionary to attrlist (LDAPObject.search_ext) results in a memory error. See Issue #556 Root cause Function PySequence_Length can return -1 on iterables like dict. The following PyMem_NEW still succeeds due PyMem_NEW(char *, -1 + 1) being equivalent to char** PyMem_Malloc(1), which then can result in a segmentation fault later on. Solution The expected behavior should be either a raised TypeError or that any iterable which contains only strings can be passed. Commit e18c567 enables the latter which is in itself very unlikely to break anything. I would actually prefer to raise a TypeError in the C extension on encountering a dictionary as it is most likely an error on the callers side, maybe we can add that later. The fix in e18c567 is to use seq and PySequence_Fast_GET_SIZE to determine the size of the sequence. This way any iterable which contains only strings can be used. I added two tests in a1bdf47 which will fail without the fix in e18c567.
Open Graph Description: Problem Providing a dictionary to attrlist (LDAPObject.search_ext) results in a memory error. See Issue #556 Root cause Function PySequence_Length can return -1 on iterables like dict. The followin...
X Description: Problem Providing a dictionary to attrlist (LDAPObject.search_ext) results in a memory error. See Issue #556 Root cause Function PySequence_Length can return -1 on iterables like dict. The followin...
Opengraph URL: https://github.com/python-ldap/python-ldap/pull/555
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2db28de9-2d76-8ef8-c5c1-62408dbbd1fe |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8CEE:2A07B7:C084B1B:F988957:6976B238 |
| html-safe-nonce | 8755b08c22d3a4851e7eff4b2da90704045e0bfa32c540c3142d638688e2a3d0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0VFOjJBMDdCNzpDMDg0QjFCOkY5ODg5NTc6Njk3NkIyMzgiLCJ2aXNpdG9yX2lkIjoiMjMxNjcxNzAzOTI0Nzg2NDM3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fdcdab00abd0e9bf3c5427c6b18b5eea0b5e49437719f4ca88e67955cd41c81b |
| hovercard-subject-tag | pull_request:1667695393 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-ldap/python-ldap/pull/555/files |
| twitter:image | https://avatars.githubusercontent.com/u/155648714?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/155648714?s=400&v=4 |
| og:image:alt | Problem Providing a dictionary to attrlist (LDAPObject.search_ext) results in a memory error. See Issue #556 Root cause Function PySequence_Length can return -1 on iterables like dict. The followin... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 032152924a283b83384255d9489e7b93b54ba01da8d380b05ecd3953b3212411 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python-ldap/python-ldap git https://github.com/python-ldap/python-ldap.git |
| octolytics-dimension-user_id | 33895877 |
| octolytics-dimension-user_login | python-ldap |
| octolytics-dimension-repository_id | 111794776 |
| octolytics-dimension-repository_nwo | python-ldap/python-ldap |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 111794776 |
| octolytics-dimension-repository_network_root_nwo | python-ldap/python-ldap |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5b577f6be6482e336e3c30e8daefa30144947b17 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width