[commit] r2145 - reject requests to increase memory by ludicrous amounts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2145 - reject requests to increase memory by ludicrous amounts

commits-3
 
Author: piumarta
Date: 2009-10-20 19:44:33 -0700 (Tue, 20 Oct 2009)
New Revision: 2145

Modified:
   trunk/platforms/unix/ChangeLog
   trunk/platforms/unix/vm/sqUnixMemory.c
Log:
reject requests to increase memory by ludicrous amounts

Modified: trunk/platforms/unix/ChangeLog
===================================================================
--- trunk/platforms/unix/ChangeLog 2009-09-27 21:39:59 UTC (rev 2144)
+++ trunk/platforms/unix/ChangeLog 2009-10-21 02:44:33 UTC (rev 2145)
@@ -1,3 +1,8 @@
+2009-10-20  Ian Piumarta  <com -dot- gmail -at- piumarta (backwards)>
+
+ * vm/sqUnixMemory.c (uxGrowMemoryBy): Reject request to increase
+ memory by ludicrous amounts.
+
 2009-09-27  Ian Piumarta  <com -dot- gmail -at- piumarta (backwards)>
 
  * cmake/configure (cflags): Change '--DOPT--src=' to '-DOPT--src='.

Modified: trunk/platforms/unix/vm/sqUnixMemory.c
===================================================================
--- trunk/platforms/unix/vm/sqUnixMemory.c 2009-09-27 21:39:59 UTC (rev 2144)
+++ trunk/platforms/unix/vm/sqUnixMemory.c 2009-10-21 02:44:33 UTC (rev 2145)
@@ -26,7 +26,7 @@
  *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  *   SOFTWARE.
  *
- * Last edited: 2009-08-19 04:34:09 by piumarta on emilia-2.local
+ * Last edited: 2009-10-20 19:42:22 by piumarta on emilia-2.local
  */
 
 /* Note:
@@ -166,6 +166,11 @@
     {
       int newSize=  min(valign(oldLimit - heap + delta), heapLimit);
       int newDelta= newSize - heapSize;
+      if (newSize < 0)
+ {
+  /* requested size too large */
+  return oldLimit;
+ }
       debugf(("uxGrowMemory: %p By: %d(%d) (%d -> %d)\n", oldLimit, newDelta, delta, heapSize, newSize));
       assert(0 == (newDelta & ~pageMask));
       assert(0 == (newSize  & ~pageMask));