From abb941223dc5714a9fdfc83b3903b067ba38e0be Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 25 Jan 2006 02:39:18 +0000 Subject: [PATCH] Protect our servers from a certain DOS attack: telling the server that you're sending a giant array and having it try to allocate it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3820 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/io/ObjectInputStream.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/java/com/threerings/io/ObjectInputStream.java b/src/java/com/threerings/io/ObjectInputStream.java index 83cba9148..190a272a0 100644 --- a/src/java/com/threerings/io/ObjectInputStream.java +++ b/src/java/com/threerings/io/ObjectInputStream.java @@ -160,6 +160,10 @@ public class ObjectInputStream extends DataInputStream // and return the newly read object return target; + } catch (OutOfMemoryError oome) { + throw (IOException) + new IOException("Malformed object data").initCause(oome); + } finally { // clear out our current object references _current = null;