GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Refuse to export the Packer buffer during pack by CAOShurong · Pull Request #770 · msgpack/msgpack-python ConversationThe C Packer accepts getbuffer() while pack() is still writing. That happens from the default callback, from a dict subclass''s items(), and from pack_map_pairs(). _check_exports() runs only at the start of a public method, so the export is invisible to it. If packing then grows the buffer, PyMem_Realloc frees the block the memoryview still references. pack(), pack_map_pairs(), and pack_ext_type() now count nested calls, and the buffer protocol raises BufferError until they return. An export taken between calls is unchanged, and �ytes() still copies. #735 checks exports after the default callback only, so the items() and pack_map_pairs() paths remain open there. On Windows with Python 3.13, the extension was built with cython msgpack/_cmsgpack.pyx and installed with pip install -e .. The new tests failed on the unmodified extension and pass after this change. pytest -v test: 181 passed, 1 skipped. MSGPACK_PUREPYTHON=1 pytest -v test: 178 passed, 4 skipped. The pure Python Packer is unchanged. Its buffer is a BytesIO, so growth does not free an existing view. pack_map_pairs() still keeps a partial header when iteration raises. This was not run under AddressSanitizer. Fixes #769.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe C Packer accepted getbuffer() from a default callback, from dict.items(), and from pack_map_pairs() while it was still writing. Growing the buffer then freed the exported memory. Those methods now reject the export until they return. pytest -v test: 181 passed, 1 skipped. MSGPACK_PUREPYTHON=1 pytest -v test: 178 passed, 4 skipped. The pure Python buffer is not freed when it grows. This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Packer use-after-free via re-entrantgetbuffer() during pack()
Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| 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. |