title: How to prevent stack corruption?
body: <p>I'm trying to debug segfault in native app for android.
  GDB shows the following:</p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 5200]
  0xbfcc6744 in ?? ()
  (gdb) bt
  #0  0xbfcc6744 in ?? ()
  #1  0x5cfb5458 in WWMath::unProject (x=2.1136094475592566, y=472.2994384765625, z=0, mvpMatrix=@0x0, 
      viewport=@0x0, result=@0x0) at jni/src/core/util/WWMath.cpp:118
  #2  0x00000000 in ?? ()
  </code></pre>
  
  <p>Is it possible to get a good stack? Or find a place where the stack was corrupted?</p>
  
  <p>UPD:
  The function mentioned takes references:</p>
  
  <pre><code>bool WWMath::unProject(double x, double y, double z, const Matrix &amp;mvpMatrix,
           const Rect&amp; viewport, Vec4&amp; result)
  </code></pre>
  
  <p>and reference to simple local variable is passed as the last argument:</p>
  
  <pre><code>Vec4 far, near;
  if (!unProject(x, y, 0, tMvp, viewport, near))
  </code></pre>