Fix 0 sized slice and sets

This commit is contained in:
Jordi Baylina
2020-10-21 15:16:31 +02:00
parent 5775294d49
commit bde0b46021
2 changed files with 6 additions and 2 deletions

View File

@@ -5103,7 +5103,7 @@ class BigBuffer {
const firstPage = Math.floor(fr / PAGE_SIZE);
const lastPage = Math.floor((fr+len-1) / PAGE_SIZE);
if (firstPage == lastPage)
if ((firstPage == lastPage)||(len==0))
return this.buffers[firstPage].slice(fr%PAGE_SIZE, fr%PAGE_SIZE + len);
let buff;
@@ -5138,6 +5138,8 @@ class BigBuffer {
const len = buff.byteLength;
if (len==0) return;
const firstPage = Math.floor(offset / PAGE_SIZE);
const lastPage = Math.floor((offset+len-1) / PAGE_SIZE);

View File

@@ -21,7 +21,7 @@ export default class BigBuffer {
const firstPage = Math.floor(fr / PAGE_SIZE);
const lastPage = Math.floor((fr+len-1) / PAGE_SIZE);
if (firstPage == lastPage)
if ((firstPage == lastPage)||(len==0))
return this.buffers[firstPage].slice(fr%PAGE_SIZE, fr%PAGE_SIZE + len);
let buff;
@@ -56,6 +56,8 @@ export default class BigBuffer {
const len = buff.byteLength;
if (len==0) return;
const firstPage = Math.floor(offset / PAGE_SIZE);
const lastPage = Math.floor((offset+len-1) / PAGE_SIZE);