Skip to content

fix(native): Possible segv in system data source creation#27807

Open
czentgr wants to merge 1 commit into
prestodb:masterfrom
czentgr:cz_fix_possible_segv
Open

fix(native): Possible segv in system data source creation#27807
czentgr wants to merge 1 commit into
prestodb:masterfrom
czentgr:cz_fix_possible_segv

Conversation

@czentgr
Copy link
Copy Markdown
Contributor

@czentgr czentgr commented May 14, 2026

If the handle is null it is accessed to provide data to print the error message. This results in invalid memory access and a possible segv.

Description

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

Summary by Sourcery

Bug Fixes:

  • Prevent possible segmentation fault by avoiding access to a potentially null column handle when formatting validation error messages in the system connector.

Summary by Sourcery

Bug Fixes:

  • Avoid potential segmentation fault by using the validated column handle from the map instead of the possibly null handle when formatting error messages in system data source creation.

If the handle is null it is accessed to provide data to print the
error message. This results in invalid memory access and a
possible segv.
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label May 14, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 14, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes a potential segmentation fault in SystemDataSource construction by avoiding dereferencing a possibly null column handle when formatting a validation error message for system connector column handles.

File-Level Changes

Change Details Files
Guard error-message formatting against null column handle in system connector data source creation.
  • Change the formatted error message to use the validated map entry's column handle name instead of the possibly null handle pointer
  • Preserve the existing validation logic while ensuring no dereference occurs on a null handle when constructing the error string
  • Keep the lookup and subsequent column index resolution behavior unchanged aside from the safer name access
presto-native-execution/presto_cpp/main/connectors/SystemConnector.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@czentgr czentgr marked this pull request as ready for review May 15, 2026 15:52
@czentgr czentgr requested review from a team as code owners May 15, 2026 15:52
@prestodb-ci prestodb-ci requested review from a team, aaneja and xin-zhang2 and removed request for a team May 15, 2026 15:52
@czentgr czentgr requested a review from aditi-pandit May 15, 2026 15:52
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @czentgr

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

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants