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

gh-92434: Silence a compiler warning in _sqlite/connection.c for 32bit version #93090

Merged
merged 8 commits into from Jun 10, 2022

Conversation

neonene
Copy link
Contributor

@neonene neonene commented May 23, 2022

MSVC emits a possible loss of data warning when building 32bit version of _sqlite3.Connection.serialize(), whose data size is should be limited to 0x7fffffff in sqlite-3.38.4.0/sqlite3.c, even on 64bit python (EDIT: Sorry, I missed the pages):

SQLITE_PRIVATE void *sqlite3Malloc(u64 n){
  void *p;
  if( n==0 || n>=0x7fffff00 ){
    /* A memory allocation of a number of bytes which is near the maximum
    ** signed integer value might cause an integer overflow inside of the
    ** xMalloc().  Hence we limit the maximum size to 0x7fffff00, giving
    ** 255 bytes of overhead.  SQLite itself will never use anything near
    ** this amount.  The only way to reach the limit is with sqlite3_malloc() */
    p = 0;
  }else if( sqlite3GlobalConfig.bMemstat ){
    ...

#92434

@erlend-aasland erlend-aasland linked an issue May 25, 2022 that may be closed by this pull request
2 tasks
Modules/_sqlite/connection.c Outdated Show resolved Hide resolved
Modules/_sqlite/connection.c Outdated Show resolved Hide resolved
@erlend-aasland erlend-aasland merged commit d8395eb into python:main Jun 10, 2022
12 checks passed
@erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jun 10, 2022

Thanks for you PR, @neonene, and thanks for sorting out the nitty gritty details, Kumar! If there are still unresolved issues, please open a new issue in the bug tracker.

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 10, 2022

Thanks @neonene for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 10, 2022
…n.c on 32-bit systems (pythonGH-93090)

(cherry picked from commit d8395eb)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jun 10, 2022

GH-93672 is a backport of this pull request to the 3.11 branch.

miss-islington added a commit that referenced this issue Jun 10, 2022
… 32-bit systems (GH-93090)

(cherry picked from commit d8395eb)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
@neonene
Copy link
Contributor Author

@neonene neonene commented Jun 10, 2022

@kumaraditya303 Do you know the possibility around Py_SSIZE_T_MAX(2G) bytes, not more than 4GB?

@kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Jun 10, 2022

Do you know the possibility around Py_SSIZE_T_MAX(2G) bytes, not more than 4GB?

Please create a new issue to discuss this.

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

Successfully merging this pull request may close these issues.

6 participants