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 — Check exported buffers after the default callback returns by AbhinavMir · Pull Request #735 · msgpack/msgpack-python

Conversation

@AbhinavMir

@AbhinavMir AbhinavMir commented Aug 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

#733

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AbhinavMir
Check exported buffers after the default callback returns
bf05d32
The default callback can export the internal buffer with getbuffer().
The packer then continues and can reallocate that buffer.
The export points at freed memory after the reallocation.

Call _check_exports() after the callback returns. The packer now
raises BufferError. The pure Python packer already raises BufferError
in this case.
@methane
methane requested a balanced review from Copilot August 30, 2026 08:18
Copilot started reviewing on behalf of methane August 30, 2026 08:18
View session
Copilot AI reviewed Aug 30, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Other supported user-code hooks can still export the buffer before a reallocating write.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Prevents buffer invalidation after default exports the packer’s internal buffer.

Changes:

  • Checks active exports after default returns.
  • Adds regression coverage for the unsafe reallocation scenario.
File summaries
File Description
msgpack/_packer.pyx Adds post-callback export validation.
test/test_buffer.py Tests exported-buffer safety during callbacks.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread msgpack/_packer.pyx
Comment on lines +267 to +269
# The callback may have exported the internal buffer.
# Packing on would reallocate it and invalidate the export.
self._check_exports()
@AmirWilayah AmirWilayah mentioned this pull request Nov 5, 2026
Packer use-after-free via re-entrant getbuffer() during pack() #769
Open
@CAOShurong CAOShurong mentioned this pull request Nov 5, 2026
Refuse to export the Packer buffer during pack #770
Open

This branch has not been deployed

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AbhinavMir
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.