Skip to content

Add GC_GUARD's for encoding converted strings sent to the server#706

Open
larskanis wants to merge 1 commit into
masterfrom
DFVULN-805
Open

Add GC_GUARD's for encoding converted strings sent to the server#706
larskanis wants to merge 1 commit into
masterfrom
DFVULN-805

Conversation

@larskanis
Copy link
Copy Markdown
Collaborator

The intermediate String object wasn't stored, so that the underlying memory could be free'd before the C string was processed.

Fixes #705

The intermediate String object wasn't stored, so that the underlying memory could be free'd before the C string was processed.

Fixes #705
Copy link
Copy Markdown
Owner

@ged ged left a comment

Choose a reason for hiding this comment

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

Very interesting. I now realize I have several personal projects that should be RB_GC_GUARDing some strings.

@ged
Copy link
Copy Markdown
Owner

ged commented Jun 2, 2026

Build failures look unrelated to this fix.

@larskanis
Copy link
Copy Markdown
Collaborator Author

Very interesting. I now realize I have several personal projects that should be RB_GC_GUARDing some strings.

Fortunately RB_GC_GUARD is well described here. But since it's only necessary in some corner cases, it's easily missed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DFVULN-805: Transcoded PG::Connection#send_query Query Causes Heap Use-After-Free

2 participants