aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbutl/json/serializer.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbutl/json/serializer.cxx b/libbutl/json/serializer.cxx
index 6f9bc95..84941ed 100644
--- a/libbutl/json/serializer.cxx
+++ b/libbutl/json/serializer.cxx
@@ -363,7 +363,9 @@ namespace butl
if (overflow_ == nullptr)
return false;
- overflow_ (data_, e, buf_, size + extra - cap);
+ extra += size;
+ extra -= cap;
+ overflow_ (data_, e, buf_, extra > min ? extra : min);
cap = buf_.capacity - buf_.size;
return cap >= min;