Repository navigation
Commit 54867cd
sqlite: throw on oversized strings instead of aborting
Several conversions from SQLite text to V8 strings passed a length of
-1 to String::NewFromUtf8(). With that length, V8 skips its length
check and aborts the process when the UTF-8 text exceeds
String::kMaxLength.
SQLite error messages embed the offending identifier or token, so
CreateSQLiteErrorImpl() could hit this. NullableSQLiteStringToValue(),
used for setAuthorizer() callback arguments and statement.columns()
metadata, had the same problem, and the authorizer also called
ToLocalChecked() on each argument.
Convert error messages with Utf8StringMaybeOneByte(), and check the
length up front in NullableSQLiteStringToValue(), so oversized strings
throw ERR_STRING_TOO_LONG as column values already do. In the
authorizer, deny the action and let the pending error reach the caller.
Signed-off-by: Trivikram Kamat <[email protected]>
Assisted-by: claude:opus-5.5
PR-URL: #66521
Fixes: #66520
Fixes: #66522
Reviewed-By: Guilherme Araújo <[email protected]>
Reviewed-By: Aviv Keller <[email protected]>
Reviewed-By: James M Snell <[email protected]>1 parent 1e8247a commit 54867cd
2 files changed
Lines changed: 50 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
| |||
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
402 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
403 | 413 | | |
404 | 414 | | |
405 | 415 | | |
| |||
3631 | 3641 | | |
3632 | 3642 | | |
3633 | 3643 | | |
3634 | | - | |
3635 | | - | |
3636 | | - | |
3637 | | - | |
3638 | | - | |
3639 | | - | |
3640 | | - | |
3641 | | - | |
3642 | | - | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
3643 | 3653 | | |
3644 | 3654 | | |
3645 | 3655 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
1448 | 1452 | | |
1449 | 1453 | | |
1450 | 1454 | | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
1451 | 1458 | | |
1452 | 1459 | | |
1453 | 1460 | | |
| |||
1458 | 1465 | | |
1459 | 1466 | | |
1460 | 1467 | | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
1461 | 1489 | | |
1462 | 1490 | | |
1463 | 1491 | | |
| |||
0 commit comments