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
Merged

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
@erlend-aasland erlend-aasland added the 3.11 only security fixes label Jun 2, 2022
@erlend-aasland
Copy link
Contributor

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.

@erlend-aasland erlend-aasland added the needs backport to 3.11 only security fixes label Jun 10, 2022
@miss-islington
Copy link
Contributor

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

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jun 10, 2022
@bedevere-bot
Copy link

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

@neonene
Copy link
Contributor Author

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

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

Please create a new issue to discuss this.

@neonene neonene deleted the sqlwarn branch June 17, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible loss of data warnings when building 32bit executable since 3.11
6 participants