Skip to content

Conversation

@amoeba
Copy link
Member

@amoeba amoeba commented Dec 12, 2025

This test covers the behavior of AdbcDatabaseGetOption with out different out buffer lengths and exposes what I think is a bug in

if (*length <= result->size() + 1) {

@amoeba amoeba requested a review from lidavidm as a code owner December 12, 2025 19:16
@github-actions github-actions bot modified the milestone: ADBC Libraries 22 Dec 12, 2025
@amoeba amoeba changed the title fix(driver_manager): incorrect buffer length check in AdbcDatabaseGetOption fix(c/driver_manager): incorrect buffer length check in AdbcDatabaseGetOption Dec 12, 2025
@amoeba
Copy link
Member Author

amoeba commented Dec 12, 2025

Hey @lidavidm, I saw this while debugging something else and I wasn't sure if I was understanding it right so I thought I'd put up a PR with a failing test. Does that conditional look backward?

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

Yeah, that conditional seems backwards indeed...

@amoeba amoeba requested a review from zeroshade as a code owner December 15, 2025 18:24
@amoeba amoeba force-pushed the fix/AdbcDatabaseGetOption-buf-size-check branch from 61941cd to 9018e05 Compare December 15, 2025 19:07
@amoeba
Copy link
Member Author

amoeba commented Dec 15, 2025

I pushed up a change to the conditional and rebased to pick up a fix for an unrelated CI failure.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

FWIW, do the postgres/sqlite drivers make the same mistake?

@amoeba
Copy link
Member Author

amoeba commented Dec 15, 2025

postgresql was good, I wasn't sure about sqlite.

@amoeba
Copy link
Member Author

amoeba commented Dec 15, 2025

It looks like the Go drivers may have the same issue, I'll open a fresh PR for that.

@amoeba
Copy link
Member Author

amoeba commented Dec 15, 2025

I looked at postgres and the base framework (which sqlite delegates to) and they both have the correct behavior. The Go drivers look to have the wrong logic, I'll file a follow-up PR when I confirm.

@amoeba amoeba merged commit d5983ce into apache:main Dec 15, 2025
74 of 76 checks passed
@amoeba
Copy link
Member Author

amoeba commented Dec 15, 2025

Update: The go driver implementation looks fine so we don't need a follow-up PR.

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.

2 participants