Author: adrian
Date: Sun Oct 31 13:31:34 2010
New Revision: 9208

URL: http://svn.slimdevices.com/jive?rev=9208&view=rev
Log:
Bug: N/A
Description: fix OOM condition caused by Rtmp code building unconstrained 
length string as input buffer

Modified:
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua?rev=9208&r1=9207&r2=9208&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua Sun Oct 31 
13:31:34 2010
@@ -394,15 +394,21 @@
 
        while readmore do
 
-               local new, error = stream:readToLua()
-               if error then
-                       stream:setStreaming(false)
-                       stream:disconnect()
-                       return
-               end
-               if new then
-                       inBuf = inBuf .. new
-                       receivedBytes = receivedBytes + string.len(new)
+               -- read new data, contraining the size of our input buffer
+               -- without this check, fast servers can send us too much data 
causing OOM conditions
+               if string.len(inBuf) < 8192 then
+
+                       local new, error = stream:readToLua()
+                       if error then
+                               stream:setStreaming(false)
+                               stream:disconnect()
+                               return
+                       end
+                       if new then
+                               inBuf = inBuf .. new
+                               receivedBytes = receivedBytes + string.len(new)
+                       end
+
                end
 
                readmore = false

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to