mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-23 19:04:43 +02:00
MEDIUM: compression: Be sure to never compress more than a chunk at once
When the compression is performed, a trash chunk is used. So be sure to never compression more data than the trash size. Otherwise the commression could fail. Today, this cannot happen. But with the large buffers support on channels, it could be an issue. Note that this part should be reviewed to evaluate if we should use a larger chunk too to perform the compression, maybe via an option.
This commit is contained in:
@@ -302,6 +302,10 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
|
||||
last = 0;
|
||||
v.len = len;
|
||||
}
|
||||
if (v.len > b_size(&trash)) {
|
||||
last = 0;
|
||||
v.len = b_size(&trash);
|
||||
}
|
||||
|
||||
ret = htx_compression_buffer_add_data(st, v.ptr, v.len, &trash, dir);
|
||||
if (ret < 0 || htx_compression_buffer_end(st, &trash, last, dir) < 0)
|
||||
|
||||
Reference in New Issue
Block a user