Index: trunk/psLib/src/sys/psAssert.h
===================================================================
--- trunk/psLib/src/sys/psAssert.h	(revision 8921)
+++ trunk/psLib/src/sys/psAssert.h	(revision 9538)
@@ -6,6 +6,20 @@
 #include <math.h>
 
+#include "psMemory.h"
 #include "psError.h"
 #include "psLogMsg.h"
+
+// Ensure this is a psLib pointer, by checking for the memblock bounds.
+#define PS_ASSERT_PTR(NAME, RVAL) \
+{ \
+    psMemBlock *mb = (psMemBlock*)(NAME) - 1; \
+    if (mb->startblock != P_PS_MEMMAGIC || mb->endblock != P_PS_MEMMAGIC || \
+            *(psPtr *)((int8_t *) (mb + 1) + mb->userMemorySize) != P_PS_MEMMAGIC) { \
+        psError(PS_ERR_MEMORY_CORRUPTION, false, \
+                "Error: Pointer %s is corrupted or not on the PS memory system.", \
+                #NAME); \
+        return (RVAL); \
+    } \
+}
 
 #define PS_ASSERT_INT_UNEQUAL(NAME1, NAME2, RVAL) \
