Skip to content

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.
🐍🍒⛏🤖

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

(cherry picked from commit d8395eb)

Co-authored-by: neonene <[email protected]>
@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.

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

(cherry picked from commit d8395eb)

Co-authored-by: neonene <[email protected]>
@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.