$NetBSD: patch-ae,v 1.2 2006/10/10 00:22:28 dmcmahill Exp $

--- src/player.c.orig	2002-12-10 14:30:26.000000000 -0500
+++ src/player.c	2006-10-09 13:31:30.464278000 -0400
@@ -44,4 +44,11 @@
 #include "player/meta.h"     /* Provides: record interpreters            */
 
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifndef UINT32_MAX
+#include <limits.h>
+#endif
+
 /**
  * @internal
@@ -133,6 +140,12 @@
 	}
 
-/*	P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API)-3) * 2 * sizeof (unsigned char));
- */	P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API)  ) * 2 * sizeof (unsigned char));
+	if (MAX_REC_SIZE(API) > UINT32_MAX/ 2)
+	{
+		API->err = wmf_E_InsMem;
+		WMF_DEBUG (API,"bailing...");
+		return (API->err);
+	}
+	
+ 	P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API)  ) * 2 * sizeof (unsigned char));
 
 	if (ERR (API))
