1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Fix an instance of signed arithmetic overflow and an one bit-shift overflow.

Mark six other signed arithmetic overflow locations that need fixing.

FossilOrigin-Name: 04abab71ecd52f6070b9f84781a3df3d6dba7722
This commit is contained in:
drh
2011-03-05 13:54:15 +00:00
parent 92e4feb74c
commit cfd654bf2a
12 changed files with 33 additions and 27 deletions

View File

@@ -2497,7 +2497,13 @@ u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
if( file_format>=4 && (i&1)==i ){
return 8+(u32)i;
}
u = i<0 ? -i : i;
if( i<0 ){
if( i<(-MAX_6BYTE) ) return 6;
/* Previous test prevents: u = -(-9223372036854775808) */
u = -i;
}else{
u = i;
}
if( u<=127 ) return 1;
if( u<=32767 ) return 2;
if( u<=8388607 ) return 3;