794255e6c5dbc7fb54e31ce12022e69f8ca9d0bd
[packages.git] / net / haproxy / patches / 0008-MEDIUM-increase-chunk-size-limit-to-2GB-1.patch
1 From 92518a563b9c1f9117e1dec2cc2a8ae95b1643d6 Mon Sep 17 00:00:00 2001
2 From: Willy Tarreau <w@1wt.eu>
3 Date: Fri, 24 Feb 2012 19:20:12 +0100
4 Subject: [PATCH 8/9] MEDIUM: increase chunk-size limit to 2GB-1
5
6 Since commit 115acb97, chunk size was limited to 256MB. There is no reason for
7 such a limit and the comment on the code suggests a missing zero. However,
8 increasing the limit past 2 GB causes trouble due to some 32-bit subtracts
9 in various computations becoming negative (eg: buffer_max_len). So let's limit
10 the chunk size to 2 GB - 1 max.
11 (cherry picked from commit 431946e9617572d2813bd5a8f5a51ce36f841ea3)
12 ---
13  src/proto_http.c | 2 +-
14  1 file changed, 1 insertion(+), 1 deletion(-)
15
16 diff --git a/src/proto_http.c b/src/proto_http.c
17 index 22a7737..7fd1fe6 100644
18 --- a/src/proto_http.c
19 +++ b/src/proto_http.c
20 @@ -2112,7 +2112,7 @@ int http_parse_chunk_size(struct buffer *buf, struct http_msg *msg)
21                         break;
22                 if (++ptr >= end)
23                         ptr = buf->data;
24 -               if (chunk & 0xF000000) /* overflow will occur */
25 +               if (chunk & 0xF8000000) /* integer overflow will occur if result >= 2GB */
26                         goto error;
27                 chunk = (chunk << 4) + c;
28         }
29 -- 
30 1.8.1.5
31