1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

Fix: take control buffer offset/length into account again (#3769)

This commit is contained in:
Bert Belder 2020-01-24 05:34:55 +01:00 committed by GitHub
parent 9f1e4237a5
commit a6a7253df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -396,8 +396,11 @@ fn send(
let control = match v8::Local::<v8::ArrayBufferView>::try_from(args.get(1)) { let control = match v8::Local::<v8::ArrayBufferView>::try_from(args.get(1)) {
Ok(view) => { Ok(view) => {
let byte_offset = view.byte_offset();
let byte_length = view.byte_length();
let backing_store = view.buffer().unwrap().get_backing_store(); let backing_store = view.buffer().unwrap().get_backing_store();
unsafe { &**backing_store.get() } let buf = unsafe { &**backing_store.get() };
&buf[byte_offset..byte_offset + byte_length]
} }
Err(..) => &[], Err(..) => &[],
}; };