mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-15 16:01:30 +00:00
Fix possible use after free in Array#forEach if the array resizes halfway (#408)
This commit is contained in:
@ -250,9 +250,8 @@ export class Array<T> {
|
||||
}
|
||||
|
||||
forEach(callbackfn: (value: T, index: i32, array: Array<T>) => void): void {
|
||||
var buffer = this.buffer_;
|
||||
for (let index = 0, toIndex = this.length_; index < toIndex && index < this.length_; ++index) {
|
||||
callbackfn(LOAD<T>(buffer, index), index, this);
|
||||
callbackfn(LOAD<T>(this.buffer_, index), index, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user