Skip to content

Commit 452a9b6

Browse files
committed
Fix out-of-bounds indexing
1 parent 0bfba4d commit 452a9b6

File tree

2 files changed

+6
-2
lines changed
  • lib/node_modules/@stdlib/ndarray/base/assert

2 files changed

+6
-2
lines changed

lib/node_modules/@stdlib/ndarray/base/assert/is-safe-data-type-cast/benchmark/benchmark.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ bench( pkg, function benchmark( b ) {
3838
var out;
3939
var i;
4040
var j;
41+
var k;
4142

4243
b.tic();
4344
for ( i = 0; i < b.iterations; i++ ) {
4445
j = i % DTYPES.length;
45-
out = isSafeCast( DTYPES[ j ], DTYPES[ j+1 ] );
46+
k = (i+1) % DTYPES.length;
47+
out = isSafeCast( DTYPES[ j ], DTYPES[ k ] );
4648
if ( typeof out !== 'boolean' ) {
4749
b.fail( 'should return a boolean' );
4850
}

lib/node_modules/@stdlib/ndarray/base/assert/is-same-kind-data-type-cast/benchmark/benchmark.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ bench( pkg, function benchmark( b ) {
3838
var out;
3939
var i;
4040
var j;
41+
var k;
4142

4243
b.tic();
4344
for ( i = 0; i < b.iterations; i++ ) {
4445
j = i % DTYPES.length;
45-
out = isSameKindCast( DTYPES[ j ], DTYPES[ j+1 ] );
46+
k = (i+1) % DTYPES.length;
47+
out = isSameKindCast( DTYPES[ j ], DTYPES[ k ] );
4648
if ( typeof out !== 'boolean' ) {
4749
b.fail( 'should return a boolean' );
4850
}

0 commit comments

Comments
 (0)