SQLite

Check-in [62114711]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix possible integer overflow in bounds checking for the debugging function "shell_int32()" found in the CLI. This change does not affect the core SQLite. Forum post be9c294ee0.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6211471138a654641a4cf4831cfa3b470e06f29a2b77e4d58177c8e065bec11e
User & Date: drh 2023-03-24 21:35:48
Context
2023-03-24
22:17
Remove undocumented, vestigial SQL functions in the CLI that were once used for the ".recover" command but are now no longer needed. (check-in: 1ef461aa user: drh tags: trunk)
21:35
Fix possible integer overflow in bounds checking for the debugging function "shell_int32()" found in the CLI. This change does not affect the core SQLite. Forum post be9c294ee0. (check-in: 62114711 user: drh tags: trunk)
21:24
Fix an error in the OP_SeekScan opcode added by check-in [4a43430fd23f8835]. Problem reported by forum post 8cc1dc0fe9. (check-in: 651a13fc user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
  int iInt;

  UNUSED_PARAMETER(argc);
  nBlob = sqlite3_value_bytes(argv[0]);
  pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
  iInt = sqlite3_value_int(argv[1]);

  if( iInt>=0 && (iInt+1)*4<=nBlob ){
    const unsigned char *a = &pBlob[iInt*4];
    sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
                       + ((sqlite3_int64)a[1]<<16)
                       + ((sqlite3_int64)a[2]<< 8)
                       + ((sqlite3_int64)a[3]<< 0);
    sqlite3_result_int64(context, iVal);
  }







|







5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
  int iInt;

  UNUSED_PARAMETER(argc);
  nBlob = sqlite3_value_bytes(argv[0]);
  pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
  iInt = sqlite3_value_int(argv[1]);

  if( iInt>=0 && iInt<(nBlob/4) ){
    const unsigned char *a = &pBlob[iInt*4];
    sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
                       + ((sqlite3_int64)a[1]<<16)
                       + ((sqlite3_int64)a[2]<< 8)
                       + ((sqlite3_int64)a[3]<< 0);
    sqlite3_result_int64(context, iVal);
  }