Unverified Commit 4972760b authored by ranshid's avatar ranshid Committed by GitHub
Browse files

assert in case resize output buffer will attempt to shrink too much (#11839)

Currently there is no BUG. However during some internal code changes
I found that it can happen (for example in case new code will not update
the buf_peak) which can currently lead to memory overrun which is much
harder to detect and root cause.

Why did I please the assert here? The reason is to be able to have the
buf_peak value without the risk of it being overriden by the peak_reset
parent c8226ae3
...@@ -789,6 +789,8 @@ int clientsCronResizeOutputBuffer(client *c, mstime_t now_ms) { ...@@ -789,6 +789,8 @@ int clientsCronResizeOutputBuffer(client *c, mstime_t now_ms) {
server.stat_reply_buffer_expands++; server.stat_reply_buffer_expands++;
} }
serverAssertWithInfo(c, NULL, (!new_buffer_size) || (new_buffer_size >= (size_t)c->bufpos));
/* reset the peak value each server.reply_buffer_peak_reset_time seconds. in case the client will be idle /* reset the peak value each server.reply_buffer_peak_reset_time seconds. in case the client will be idle
* it will start to shrink. * it will start to shrink.
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment