diff options
author | Sven Gothel <[email protected]> | 2013-10-12 14:55:20 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-12 14:55:20 -0700 |
commit | 5d63f8eff18b9b3ce3763c1da4a1d750a8490e6f (patch) | |
tree | dfa515fbff878a5c2666a59c4eb6c58c2735457d /src/jogl/classes/jogamp/opengl/glu | |
parent | 38bc1dbe6d2402218bc348516545b25e4db177b9 (diff) | |
parent | ed53220b4faccfd184b212bb89a075bfa53ea886 (diff) |
Merge pull request #71 from esemplare/master
Fix Bug 365: Bug on javax.media.opengl.glu.GLU.gluBuild2DMipmaps
I will commit your unit test manually from the bug report (pls add it to your pull request next time)
Thank you!
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/glu')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java | 77 |
1 files changed, 63 insertions, 14 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index 5f086ceff..9c95ae304 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -195,8 +195,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { @@ -414,8 +421,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { @@ -632,8 +646,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { @@ -915,8 +936,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { @@ -1210,8 +1238,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { @@ -1500,8 +1535,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { @@ -1797,8 +1839,15 @@ public class ScaleInternal { highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; - highx_int = convx_int; - highx_float = convx_float; + // If we have a single column, fix the max width values + // to prevent buffer overflow + if (widthin == 1 && widthout == 1) { + highx_int = 0; + highx_float = 0.0f; + } else { + highx_int = convx_int; + highx_float = convx_float; + } for( j = 0; j < widthout; j++ ) { |