sqlite: validate maxSize argument in createTagStore() - #63792
sqlite: validate maxSize argument in createTagStore()#63792Anshikakalpana wants to merge 1 commit into
Conversation
|
Review requested:
|
68d5139 to
3c0477b
Compare
| code: 'ERR_INVALID_ARG_TYPE', | ||
| message: /maxSize/, | ||
| }); | ||
|
|
||
| assert.throws(() => db.createTagStore(1.5), { | ||
| code: 'ERR_INVALID_ARG_TYPE', |
There was a problem hiding this comment.
This should likely be ERR_OUT_OF_RANGE, like e.g. node -e 'child_process.spawn("/dev/null", { uid: 1.3 })' does
There was a problem hiding this comment.
Fixed — floats now throw ERR_OUT_OF_RANGE instead of ERR_INVALID_ARG_TYPE.
There was a problem hiding this comment.
@Anshikakalpana Can you update the PR description to include this change?
The non-integer values (NaN, floats, strings) no longer throw ERR_INVALID_ARG_TYPE
3c0477b to
406e215
Compare
|
Hi @aduh95! I addressed all the review comments and updated the PR. Could you please take another look when you have a chance? Thanks! |
This comment was marked as outdated.
This comment was marked as outdated.
406e215 to
b81b873
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63792 +/- ##
==========================================
- Coverage 90.31% 90.30% -0.02%
==========================================
Files 759 759
Lines 248288 248302 +14
Branches 46857 46858 +1
==========================================
- Hits 224247 224223 -24
- Misses 15471 15514 +43
+ Partials 8570 8565 -5
🚀 New features to boost your workflow:
|
b81b873 to
de6789b
Compare
Signed-off-by: anshikakalpana <anshikajain196872@gmail.com>
de6789b to
6371aa2
Compare
Fixes: #63791
database.createTagStore()accepted invalid values for itsmaxSizeargument without throwing. Negative integers caused integer overflow, NaN and floats produced garbage capacity values, and strings were silently ignored.The
maxSizeparameter is documented as{integer}and represents a cache size, so negative values are meaningless.This PR adds validation to reject:
ERR_INVALID_ARG_TYPEERR_OUT_OF_RANGEEdit: non-integer values (NaN, floats, strings) no longer throw
ERR_INVALID_ARG_TYPE.