Skip to content

Commit

Permalink
src: change Fill() to use ParseArrayIndex()
Browse files Browse the repository at this point in the history
Changed Fill() to use ParseArrayIndex() when getting start and end of buffers instead of Uint32Value, supporting buffers of greater than 2**32

Fixes: nodejs#31514
  • Loading branch information
DavenportEmma committed Feb 3, 2020
1 parent 43fb6ff commit a60a104
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,11 @@ void Fill(const FunctionCallbackInfo<Value>& args) {
THROW_AND_RETURN_UNLESS_BUFFER(env, args[0]);
SPREAD_BUFFER_ARG(args[0], ts_obj);

uint32_t start;
if (!args[2]->Uint32Value(ctx).To(&start)) return;
uint32_t end;
if (!args[3]->Uint32Value(ctx).To(&end)) return;
size_t start;
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[2], 0, &start));
size_t end;
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[3], 0, &end));

size_t fill_length = end - start;
Local<String> str_obj;
size_t str_length;
Expand Down

0 comments on commit a60a104

Please sign in to comment.