GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — buffer: properly apply dst offset and src length on fast path · nodejs/node@8ba53ae

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_buffer.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,11 +1479,12 @@ uint32_t FastWriteString(Local<Value> receiver,
14791479
CHECK(offset <= dst.length());
14801480
CHECK(dst.length() - offset <= std::numeric_limits<uint32_t>::max());
14811481

1482-
max_length = std::min<uint32_t>(dst.length() - offset, max_length);
1482+
const auto size = std::min(
1483+
{static_cast<uint32_t>(dst.length() - offset), max_length, src.length});
14831484

1484-
memcpy(dst_data, src.data, max_length);
1485+
memcpy(dst_data + offset, src.data, size);
14851486

1486-
return max_length;
1487+
return size;
14871488
}
14881489

14891490
static v8::CFunction fast_write_string(v8::CFunction::Make(FastWriteString));

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.