diff -urN wireshark-1.4.9/wiretap/erf.c wireshark-1.4.10/wiretap/erf.c
--- wireshark-1.4.9/wiretap/erf.c	2011-09-07 17:12:35.000000000 -0700
+++ wireshark-1.4.10/wiretap/erf.c	2011-11-01 09:41:19.000000000 -0700
@@ -345,6 +345,14 @@
     return FALSE;
   }
 
+  if (*packet_size == 0) {
+    /* Again a corrupt packet, bail out */
+   *err = WTAP_ERR_BAD_RECORD;
+   *err_info = g_strdup_printf("erf: File has 0 byte packet");
+
+   return FALSE;
+  }
+
   if (phdr != NULL) {
     guint64 ts = pletohll(&erf_header->ts);
 
@@ -444,5 +452,17 @@
     phdr->caplen = min( g_htons(erf_header->wlen),
 			g_htons(erf_header->rlen) - (guint32)sizeof(*erf_header) - skiplen );
   }
+
+  if (*packet_size > WTAP_MAX_PACKET_SIZE) {
+    /*
+     * Probably a corrupt capture file; don't blow up trying
+     * to allocate space for an immensely-large packet.
+     */
+    *err = WTAP_ERR_BAD_RECORD;
+    *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u",
+                                *packet_size, WTAP_MAX_PACKET_SIZE);
+    return FALSE;
+  }
+
   return TRUE;
 }
