title: Weird SCNGeometrySource data
body: <p>I am trying to access <code>SCNGeometrySource</code> content. After inspecting the source I can tell that:</p>
  
  <pre class="lang-swift prettyprint-override"><code>source.bytesPerComponent = 4
  source.componentsPerVector = 3
  source.dataStride = 16
  source.dataOffset = 0
  source.vectorCount = 98304
  </code></pre>
  
  <p>In other terms, I have <code>98304</code> vectors of float3.  </p>
  
  <p>Yet, when calling</p>
  
  <pre class="lang-swift prettyprint-override"><code>source.data.withUnsafeBytes { (pointer: UnsafePointer&lt;float3&gt;) in
      for i in 0..&lt;source.vectorCount {
          print((pointer + i).pointee)
      }
  }
  </code></pre>
  
  <p>The first printed elements seem about fine, but close to the end, I get weird values close to zero when they shouldn't be, crash from time to time, and memory sanitiser does detect a heap overflow.  </p>
  
  <p>I don't understand how can a heap overflow being caused even though it looks like I am accessing everything the right way.</p>
  
  <p>What should I do to isolate the cause of this issue?</p>
  
  <p><strong>EDIT (partial solution) :</strong>
  In my case, I had a custom geometry and used the <code>SCNGeometrySource(vertices: [SCNVector3])</code> initialiser. As far as I can tell there seems be a bug causing incorrect allocations on what <code>source.data</code> returns. The way around this is not to use the <code>SCNGeometrySource(vertices: [SCNVector3])</code> initialiser anymore and to instead use the <code>SCNGeometrySource(data: ...)</code> initialiser. This fixed the issue for me.</p>