1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-21 11:13:54 +03:00

Fix possible integer oveflow in the second and third argument to substr().

FossilOrigin-Name: b04b4006f38f83d36eaf43c4bace7d53866b02b45e0ddcf1704266fed3bfc11c
This commit is contained in:
drh
2024-12-18 20:29:29 +00:00
parent 47bc07d425
commit b097ef29d1
4 changed files with 16 additions and 10 deletions

View File

@@ -363,7 +363,7 @@ static void substrFunc(
return;
}
p0type = sqlite3_value_type(argv[0]);
p1 = sqlite3_value_int(argv[1]);
p1 = sqlite3_value_int64(argv[1]);
if( p0type==SQLITE_BLOB ){
len = sqlite3_value_bytes(argv[0]);
z = sqlite3_value_blob(argv[0]);
@@ -388,7 +388,7 @@ static void substrFunc(
if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */
#endif
if( argc==3 ){
p2 = sqlite3_value_int(argv[2]);
p2 = sqlite3_value_int64(argv[2]);
if( p2<0 ){
p2 = -p2;
negP2 = 1;