couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r1058059 - /couchdb/branches/1.1.x/src/couchdb/couch_db.erl
Date Wed, 12 Jan 2011 10:46:07 GMT
Author: rnewson
Date: Wed Jan 12 10:46:07 2011
New Revision: 1058059

URL: http://svn.apache.org/viewvc?rev=1058059&view=rev
Log:
ensure write_streamed_attachment bails on negative LenLeft values

While Filipe has identified the fix for COUCHDB-1021, this patch will
ensure that no other bug will cause negative values to be passed to
this function, in turn leading to database inflation problems, etc.

Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_db.erl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_db.erl?rev=1058059&r1=1058058&r2=1058059&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_db.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_db.erl Wed Jan 12 10:46:07 2011
@@ -920,7 +920,7 @@ with_stream(Fd, #att{md5=InMd5,type=Type
 
 write_streamed_attachment(_Stream, _F, 0) ->
     ok;
-write_streamed_attachment(Stream, F, LenLeft) ->
+write_streamed_attachment(Stream, F, LenLeft) when LenLeft > 0 ->
     Bin = F(),
     ok = couch_stream:write(Stream, Bin),
     write_streamed_attachment(Stream, F, LenLeft - size(Bin)).



Mime
View raw message