aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-03-01 13:54:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-03-01 13:54:03 +0200
commit2c6a654bcfcd3bb6995266a2b1e8b076da97d8ae (patch)
tree268a9dae37704b2398876dad44a5095ba6d6f750
parentd816b9db85a66739bdb2c2b1e7d8475ce6379484 (diff)
Fix bug in JSON serializer buffer growth logicjson
-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;