From da04b2e28c6ccc73bfab542ed4dd5eada343e592 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Fri, 28 Jun 2013 08:32:10 +0200 Subject: Patch for https://bugs.php.net/bug.php?id=44522 to allow uploading files above 2G. This is essentially the same as the patch "uploads_larger_than_2g_HEAD_v2 (last revision 2012-03-26 03:59 UTC) by jason at infininull dot com)" but using off_t instead of signed long (originally: uint) I tested this on 64bit linux and succeeded uploading a file of 4.8 G. The File did not get corrupted or truncated in any way. I did not yet test this under windows or 32 bit linux Note that there are still limitations: * Did not test for files > 8 G * php does not yet reject absurdly high values * Still limited by underlying file system specific limits and free space * in upload * tmp dir and destination dir --- sapi/cgi/cgi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/cgi/cgi_main.c') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 9e6b74ac61..ec7b963339 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -508,7 +508,7 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) uint read_bytes = 0; int tmp_read_bytes; - count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes)); + count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes)); while (read_bytes < count_bytes) { tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes); if (tmp_read_bytes <= 0) { -- cgit v1.2.1