| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Also, tests and docs are needed. |
Sorry, something went wrong.
|
@geeksilva97 are you still planning to work on this? |
Sorry, something went wrong.
Hi @cjihrig . Yes, I plan to continue this. The last few weeks have been tough though. If nobody beats me I plan to get this done by April. |
Sorry, something went wrong.
Codecov ReportAttention: Patch coverage is 80.48780% with 48 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #56600 +/- ##
==========================================
- Coverage 90.24% 90.22% -0.02%
==========================================
Files 630 630
Lines 184990 185424 +434
Branches 36216 36347 +131
==========================================
+ Hits 166948 167307 +359
- Misses 11003 11016 +13
- Partials 7039 7101 +62
... and 48 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
|
I got an implementation that works. I need to add tests and clean up the code. |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
| bool lossless; | ||
| int64_t as_int = value.As<BigInt>()->Int64Value(&lossless); | ||
| if (!lossless) { | ||
| sqlite3_result_error(ctx, "BigInt value is too large for SQLite", -1); |
There was a problem hiding this comment.
Today we got a Coverity report for this line:
*** CID 519229: Memory - corruptions (BAD_FREE)
/src/node_sqlite.cc: 189 in node::sqlite::JSValueToSQLiteResult(v8::Isolate *, sqlite3_context *, v8::Local<v8::Value>)()
183 ArrayBufferViewContents<uint8_t> buf(value);
184 sqlite3_result_blob(ctx, buf.data(), buf.length(), SQLITE_TRANSIENT);
185 } else if (value->IsBigInt()) {
186 bool lossless;
187 int64_t as_int = [value.As](http://value.as/)<BigInt>()->Int64Value(&lossless);
188 if (!lossless) {
>>> CID 519229: Memory - corruptions (BAD_FREE)
>>> "sqlite3_result_error" frees array ""BigInt value is too large for SQLite"".
189 sqlite3_result_error(ctx, "BigInt value is too large for SQLite", -1);
190 return;
191 }
192 sqlite3_result_int64(ctx, as_int);
193 } else if (value->IsPromise()) {
194 sqlite3_result_error(
Sorry, something went wrong.
There was a problem hiding this comment.
Is it something I can check locally?
Sorry, something went wrong.
There was a problem hiding this comment.
It's weird that it was not complaining before. It was inline in the code; I just moved it to a method. Maybe adding inline would fix it?
Sorry, something went wrong.
There was a problem hiding this comment.
It might have complained before already. I just noticed the notification in my emails.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
It's possibly a false-positive. If you can confirm that, I will mark it as such.
Sorry, something went wrong.
There was a problem hiding this comment.
I can't confirm with absolute certainty that this is a false positive, but I also can't find anything (online examples, etc.) to support what coverity is reporting.
This paragraph from the docs makes me think this is not an issue:
The sqlite3_result_error() and sqlite3_result_error16() functions cause the implemented SQL function to throw an exception. SQLite uses the string pointed to by the 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() as the text of an error message. SQLite interprets the error message string from sqlite3_result_error() as UTF-8. SQLite interprets the string from sqlite3_result_error16() as UTF-16 using the same byte-order determination rules as sqlite3_bind_text16(). If the third parameter to sqlite3_result_error() or sqlite3_result_error16() is negative then SQLite takes as the error message all text up through the first zero character. If the third parameter to sqlite3_result_error() or sqlite3_result_error16() is non-negative then SQLite takes that many bytes (not characters) from the 2nd parameter as the error message. The sqlite3_result_error() and sqlite3_result_error16() routines make a private copy of the error message text before they return. Hence, the calling function can deallocate or modify the text after they return without harm. The sqlite3_result_error_code() function changes the error code returned by SQLite as a result of an error in a function. By default, the error code is SQLITE_ERROR. A subsequent call to sqlite3_result_error() or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
Sorry, something went wrong.
There was a problem hiding this comment.
the calling function can deallocate or modify the text after they return without harm
If we can do that, it's certainly not freed by sqlite. Marking as a false-positive, thanks!
Sorry, something went wrong.
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #56600 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Closes #56511
inspired by https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#aggregatename-options---this