Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetFileControlInt performs unsafe conversion from Go int to C int #1299

Open
rittneje opened this issue Nov 22, 2024 · 0 comments
Open

SetFileControlInt performs unsafe conversion from Go int to C int #1299

rittneje opened this issue Nov 22, 2024 · 0 comments

Comments

@rittneje
Copy link
Collaborator

Go int and C int are not guaranteed to be the same size. But right now SetFileControlInt blindly casts an int to a C.int, which can overflow or underflow. This is partially responsible for the issue described in #1298. (Even if they were the same size, it still would have been wrong for that op code because SQLite always wants a 64-bit argument even on a 32-bit architecture.)

Fix SetFileControlInt to do explicit bounds checking before casting, and return an error if the number would overflow or underflow.

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

No branches or pull requests

1 participant