diff options
-rw-r--r-- | src/net/java/games/jogl/impl/mipmap/ScaleInternal.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java b/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java index e94b09d4a..3a9306683 100644 --- a/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java +++ b/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java @@ -176,6 +176,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -382,6 +385,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -588,6 +594,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -859,6 +868,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1142,6 +1154,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1420,6 +1435,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1705,6 +1723,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1993,6 +2014,9 @@ public class ScaleInternal { highy_float = convx_float; for( i = 0; i < heightOut; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightIn) + highy_int = heightIn - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; |