Files
node/doc/api
Jinho Bang 316b5efd6b 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-16 15:22:36 -05:00
..
2018-01-16 19:57:36 +01:00
2018-01-03 17:18:30 -08:00
2018-01-12 02:51:14 +02:00
2017-12-28 16:42:46 +01:00
2018-01-16 19:57:36 +01:00
2018-01-12 02:47:22 +02:00
2017-12-07 13:49:21 -08:00
2017-12-18 10:25:43 -05:00
2018-01-10 10:24:22 -05:00
2018-01-12 02:47:22 +02:00
2018-01-12 02:51:14 +02:00
2018-01-10 10:24:22 -05:00
2017-12-12 15:59:29 -05:00
2016-04-20 16:34:27 -07:00
2018-01-12 02:47:22 +02:00
2018-01-03 23:31:34 +00:00
2017-10-31 12:59:12 -07:00
2018-01-03 17:18:30 -08:00
2017-12-15 09:26:12 -08:00
2018-01-16 15:34:04 +01:00
2018-01-03 17:18:30 -08:00
2018-01-10 10:24:22 -05:00