Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/exe.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function OnWroteExe() {

this.write(js, function () {
// Write the size of the javascript without padding
var sz = new Buffer(4);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 πŸ”΄ new Buffer(4) used instead of Buffer.alloc/Buffer.from in exe.js

Replaced new Buffer(4) with Buffer.alloc(4) in the OnWroteExe function (the write-stream callback that writes the JS length before the trailing GUID), matching the Buffer.alloc/Buffer.from style already used elsewhere in the file. This removes the deprecated/unsafe Buffer constructor and zero-fills the allocated memory.

πŸ€– Prompt for AI agents
In modules/exe.js around line 160, review and complete this code-review fix: new Buffer(4) used instead of Buffer.alloc/Buffer.from in exe.js.
What the draft fix changed: Replaced `new Buffer(4)` with `Buffer.alloc(4)` in the `OnWroteExe` function (the write-stream callback that writes the JS length before the trailing GUID), matching the `Buffer.alloc`/`Buffer.from` style already used elsewhere in the file. This removes the deprecated/unsafe Buffer constructor and zero-fills the allocated memory.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 98 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

var sz = Buffer.alloc(4);
sz.writeInt32BE(js.length, 0);
this.write(sz);

Expand All @@ -182,3 +182,4 @@ function escapeCodeString(str) {
}
return r;
}

8 changes: 4 additions & 4 deletions openssl/include/openssl/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ OPENSSL_store_u64_le(unsigned char *out, uint64_t val)
static ossl_inline ossl_unused unsigned char *

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 πŸ”΄ Copy-paste bug: OSSL_HTOLE64 guard used for be64 load/store instead of OSSL_HTOBE64/OSSL_LE64TOH

Changed the preprocessor guards in OPENSSL_store_u64_be (#ifdef OSSL_HTOLE64 -> #ifdef OSSL_HTOBE64), OPENSSL_load_u16_be (#ifdef OSSL_LE16TOH -> #ifdef OSSL_BE16TOH), OPENSSL_load_u32_be (#ifdef OSSL_LE32TOH -> #ifdef OSSL_BE32TOH), and OPENSSL_load_u64_be (#ifdef OSSL_LE64TOH -> #ifdef OSSL_BE64TOH) in openssl/include/openssl/byteorder.h, so each big-endian store/load function's fast path is now guarded by the matching BE macro instead of the coincidentally-paired LE macro, matching the fix suggested for the explicitly reported OPENSSL_store_u64_be case and applying the same correction consistently to the analogous be-load functions that had the identical latent bug.

πŸ€– Prompt for AI agents
In openssl/include/openssl/byteorder.h around line 179, review and complete this code-review fix: Copy-paste bug: OSSL_HTOLE64 guard used for be64 load/store instead of OSSL_HTOBE64/OSSL_LE64TOH.
What the draft fix changed: Changed the preprocessor guards in OPENSSL_store_u64_be (`#ifdef OSSL_HTOLE64` -> `#ifdef OSSL_HTOBE64`), OPENSSL_load_u16_be (`#ifdef OSSL_LE16TOH` -> `#ifdef OSSL_BE16TOH`), OPENSSL_load_u32_be (`#ifdef OSSL_LE32TOH` -> `#ifdef OSSL_BE32TOH`), and OPENSSL_load_u64_be (`#ifdef OSSL_LE64TOH` -> `#ifdef OSSL_BE64TOH`) in `openssl/include/openssl/byteorder.h`, so each big-endian store/load function's fast path is now guarded by the matching BE macro instead of the coincidentally-paired LE macro, matching the fix suggested for the explicitly reported OPENSSL_store_u64_be case and applying the same correction consistently to the analogous be-load functions that had the identical latent bug.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

OPENSSL_store_u64_be(unsigned char *out, uint64_t val)
{
# ifdef OSSL_HTOLE64
# ifdef OSSL_HTOBE64
uint64_t t = OSSL_HTOBE64(val);

memcpy(out, (unsigned char *)&t, 8);
Expand Down Expand Up @@ -218,7 +218,7 @@ OPENSSL_load_u16_le(uint16_t *val, const unsigned char *in)
static ossl_inline ossl_unused const unsigned char *
OPENSSL_load_u16_be(uint16_t *val, const unsigned char *in)
{
# ifdef OSSL_LE16TOH
# ifdef OSSL_BE16TOH
uint16_t t;

memcpy((unsigned char *)&t, in, 2);
Expand Down Expand Up @@ -256,7 +256,7 @@ OPENSSL_load_u32_le(uint32_t *val, const unsigned char *in)
static ossl_inline ossl_unused const unsigned char *
OPENSSL_load_u32_be(uint32_t *val, const unsigned char *in)
{
# ifdef OSSL_LE32TOH
# ifdef OSSL_BE32TOH
uint32_t t;

memcpy((unsigned char *)&t, in, 4);
Expand Down Expand Up @@ -301,7 +301,7 @@ OPENSSL_load_u64_le(uint64_t *val, const unsigned char *in)
static ossl_inline ossl_unused const unsigned char *
OPENSSL_load_u64_be(uint64_t *val, const unsigned char *in)
{
# ifdef OSSL_LE64TOH
# ifdef OSSL_BE64TOH
uint64_t t;

memcpy((unsigned char *)&t, in, 8);
Expand Down