Fossil SCM
Limit the range of rowids to 0..2147483647.
Commit
5aa2aee95fc57611d6f32635c4ee4ad15b93b9c5
Parent
d637c4d23c9dd62…
1 file changed
+6
-2
M
src/db.c
+6
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -399,12 +399,16 @@ | ||
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /* |
| 402 | 402 | ** Return the rowid of the most recent insert |
| 403 | 403 | */ |
| 404 | -i64 db_last_insert_rowid(void){ | |
| 405 | - return sqlite3_last_insert_rowid(g.db); | |
| 404 | +int db_last_insert_rowid(void){ | |
| 405 | + i64 x = sqlite3_last_insert_rowid(g.db); | |
| 406 | + if( x<0 || x>(i64)2147483647 ){ | |
| 407 | + fossil_fatal("rowid out of range (0..2147483647)"); | |
| 408 | + } | |
| 409 | + return (int)x; | |
| 406 | 410 | } |
| 407 | 411 | |
| 408 | 412 | /* |
| 409 | 413 | ** Return the number of rows that were changed by the most recent |
| 410 | 414 | ** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers |
| 411 | 415 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -399,12 +399,16 @@ | |
| 399 | } |
| 400 | |
| 401 | /* |
| 402 | ** Return the rowid of the most recent insert |
| 403 | */ |
| 404 | i64 db_last_insert_rowid(void){ |
| 405 | return sqlite3_last_insert_rowid(g.db); |
| 406 | } |
| 407 | |
| 408 | /* |
| 409 | ** Return the number of rows that were changed by the most recent |
| 410 | ** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers |
| 411 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -399,12 +399,16 @@ | |
| 399 | } |
| 400 | |
| 401 | /* |
| 402 | ** Return the rowid of the most recent insert |
| 403 | */ |
| 404 | int db_last_insert_rowid(void){ |
| 405 | i64 x = sqlite3_last_insert_rowid(g.db); |
| 406 | if( x<0 || x>(i64)2147483647 ){ |
| 407 | fossil_fatal("rowid out of range (0..2147483647)"); |
| 408 | } |
| 409 | return (int)x; |
| 410 | } |
| 411 | |
| 412 | /* |
| 413 | ** Return the number of rows that were changed by the most recent |
| 414 | ** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers |
| 415 |