Files
node/doc/api
Jinho Bang 9edf023694 n-api: throw RangeError napi_create_typedarray()
According to the ECMA spec, we should throw a RangeError in the
following cases:
  - `(length * elementSize) + offset` > the size of the array passed in
  - `offset % elementSize` != `0`

In the current implementation, this check was omitted. So, the following
code will cause a crash.
  ```
  napi_create_typedarray(env, napi_uint16_array, 2 /* length */,
                         buffer, 1 /* byte_offset */, &output_array);
  ```

This change fixes the problem and write some related tests.

Refs:
https://tc39.github.io/ecma262/#sec-typedarray-buffer-byteoffset-length

PR-URL: https://github.com/nodejs/node/pull/18037
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2018-01-30 10:19:34 -06:00
..
2018-01-09 04:54:58 -05:00
2018-01-09 03:17:43 -05:00
2018-01-09 04:32:44 -05:00
2018-01-30 09:35:53 -06:00
2017-12-12 03:28:21 -05:00
2018-01-09 03:17:35 -05:00
2018-01-17 08:44:04 -06:00
2018-01-10 03:11:46 -05:00
2018-01-30 09:35:53 -06:00
2018-01-30 09:34:57 -06:00
2018-01-10 03:11:46 -05:00
2018-01-10 01:42:24 -05:00
2016-04-20 16:34:27 -07:00
2018-01-30 09:35:53 -06:00
2018-01-09 04:54:57 -05:00
2017-10-31 11:52:36 -07:00
2018-01-09 04:54:58 -05:00
2018-01-10 03:11:46 -05:00
2018-01-10 01:42:24 -05:00
2018-01-08 02:21:03 -05:00
2018-01-09 04:54:58 -05:00
2018-01-10 03:11:46 -05:00