Skip to content

Commit 4d872c8

Browse files
committed
fix: always limit DataViews to a minimal view of struct memory
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 4ecf9ad commit 4d872c8

File tree

1 file changed

+2
-2
lines changed
  • lib/node_modules/@stdlib/dstructs/struct/lib

1 file changed

+2
-2
lines changed

lib/node_modules/@stdlib/dstructs/struct/lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ function factory( fields ) {
187187
}
188188
if ( isArrayBuffer( arg ) ) {
189189
if ( nargs === 1 ) {
190-
view = new DataView( arg );
190+
view = new DataView( arg, 0, BYTE_LENGTH );
191191
} else {
192192
if ( !isNonNegativeInteger( byteOffset ) ) {
193193
throw new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );
194194
}
195195
if ( nargs === 2 ) {
196-
view = new DataView( arg, byteOffset );
196+
view = new DataView( arg, byteOffset, BYTE_LENGTH );
197197
} else {
198198
if ( !isNonNegativeInteger( byteLength ) ) {
199199
throw new TypeError( format( 'invalid argument. Byte length must be a nonnegative integer. Value: `%s`.', byteLength ) );

0 commit comments

Comments
 (0)