platform/macclassic.c
changeset 747 3da194b12f43
parent 701 49a5ec86b8b3
child 754 e7cd7411eadf
--- a/platform/macclassic.c	Sat Aug 20 04:46:25 2005 +0000
+++ b/platform/macclassic.c	Tue Sep 06 06:24:42 2005 +0000
@@ -939,17 +939,23 @@
 } /* __PHYSFS_platformAllocatorInit */
 
 
-void *__PHYSFS_platformAllocatorMalloc(size_t s)
+void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
 {
+    /* make sure s isn't larger than the address space of the platform... */
+    if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
+        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
     #undef malloc
-    return(malloc(s));
+    return(malloc((size_t) s));
 } /* __PHYSFS_platformMalloc */
 
 
-void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
+void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
 {
+    /* make sure s isn't larger than the address space of the platform... */
+    if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
+        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
     #undef realloc
-    return(realloc(ptr, s));
+    return(realloc(ptr, (size_t) s));
 } /* __PHYSFS_platformRealloc */