title: "RangeError: Invalid typed array length" for seemingly-valid inputs
body: <p>I have the following snippet:</p>
  
  <pre><code>new Uint16Array( arraybuffer, 0, 18108 );
  </code></pre>
  
  <p>I know that <code>arraybuffer</code> is an instance of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" rel="noreferrer">ArrayBuffer</a>, and that <code>arraybuffer.byteLength</code> is 31984. The content of the arraybuffer is a black box to me. Because the buffer's byteLength is > 18108, I expect this to just work. Instead, I get the following errors:</p>
  
  <p>Chrome:</p>
  
  <blockquote>
    <p>RangeError: Invalid typed array length</p>
  </blockquote>
  
  <p>Firefox:</p>
  
  <blockquote>
    <p>TypeError: invalid arguments</p>
  </blockquote>
  
  <p>What might cause this to fail, or how can I inspect an ArrayBuffer I can't open?</p>