php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72505 readfile() mangles files larger than 2G
Submitted: 2016-06-27 12:41 UTC Modified: 2016-09-13 13:50 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mueller at relog dot ch Assigned: cmb (profile)
Status: Closed Package: Filesystem function related
PHP Version: 7.0.8 OS: SuSE linux
Private report: No CVE-ID: None
 [2016-06-27 12:41 UTC] mueller at relog dot ch
Description:
------------
when readfile() is used to output a file larger than 2G, the output is not identical with the input.

Test script:
---------------
# output mangled for files larger than 2G
bash:> dd if=largefile of=aa bs=1M count=2049 2>/dev/null; php -r 'readfile("aa");' >bb; crc32 aa bb 

b5c09ad4        aa
2e905867        bb


Expected result:
----------------
same crc32 for aa and bb (which is the case if you use count=2047)

Actual result:
--------------
different crc32 for aa and bb

Patches

readfile_largefile.patch (last revision 2016-06-27 13:52 UTC by cschneid@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-27 12:48 UTC] mueller at search dot ch
Fixed Bug Type
 [2016-06-27 12:49 UTC] mueller at relog dot ch
-: mueller at search dot ch +: mueller at relog dot ch
 [2016-06-27 12:49 UTC] mueller at relog dot ch
Email address is not well protected...
 [2016-06-27 13:19 UTC] mueller at relog dot ch
Please change status to "Private rerport: Yes" if possible, thanks.
 [2016-06-27 13:52 UTC] cschneid@php.net
The following patch has been added/updated:

Patch Name: readfile_largefile.patch
Revision:   1467035528
URL:        https://bugs.php.net/patch-display.php?bug=72505&patch=readfile_largefile.patch&revision=1467035528
 [2016-06-28 03:12 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c73a2f7f45fc4ad6bf45f5f6929606725f285cd7
Log: Fixed bug #72505 (readfile() mangles files larger than 2G)
 [2016-06-28 03:12 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-06 05:47 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c73a2f7f45fc4ad6bf45f5f6929606725f285cd7
Log: Fixed bug #72505 (readfile() mangles files larger than 2G)
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c73a2f7f45fc4ad6bf45f5f6929606725f285cd7
Log: Fixed bug #72505 (readfile() mangles files larger than 2G)
 [2016-09-13 11:45 UTC] cmb@php.net
-Type: Documentation Problem +Type: Bug -Assigned To: +Assigned To: cmb
 [2016-09-13 13:50 UTC] cmb@php.net
Didn't want to assign this closed bug to me.
 [2016-09-16 12:57 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ac07008bb7eeee46c9e45c976fc3dc264f0eadff
Log: Fixed bug #72505 (readfile() mangles files larger than 2G)
 [2016-10-17 10:08 UTC] bwoebi@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ac07008bb7eeee46c9e45c976fc3dc264f0eadff
Log: Fixed bug #72505 (readfile() mangles files larger than 2G)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC