php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66736 fpassthru broken
Submitted: 2014-02-18 19:49 UTC Modified: -
From: evert at rooftopsolutions dot nl Assigned:
Status: Closed Package: Streams related
PHP Version: 5.5.9 OS: OS X
Private report: No CVE-ID: None
 [2014-02-18 19:49 UTC] evert at rooftopsolutions dot nl
Description:
------------
fpassthru is broken for files > 2GB on 64bit systems.

Tested with OS X, but also getting reports from users of other operating systems.

Likely there's an integer overflow issue.

Reference: http://evertpot.com/fpassthru-broken/

Test script:
---------------
# 5GB file

dd if=/dev/zero of=5gb bs=1024 count=5242880
php -r "fpassthru(fopen('5gb','r'));" > output_5gb

# 3GB file

dd if=/dev/zero of=3gb bs=1024 count=3145728
php -r "fpassthru(fopen('3gb','r'));" > output_3gb

# Comparing outputs

ls -lh


Expected result:
----------------
-rw-r--r--   1 evert  staff   3.0G 18 Feb 14:43 3gb
-rw-r--r--   1 evert  staff   5.0G 18 Feb 14:41 5gb
-rw-r--r--   1 evert  staff   3.0G 18 Feb 14:45 output_3gb
-rw-r--r--   1 evert  staff   5.0G 18 Feb 14:44 output_5gb

Actual result:
--------------
-rw-r--r--   1 evert  staff   3.0G 18 Feb 14:43 3gb
-rw-r--r--   1 evert  staff   5.0G 18 Feb 14:41 5gb
-rw-r--r--   1 evert  staff     0B 18 Feb 14:45 output_3gb
-rw-r--r--   1 evert  staff   1.0G 18 Feb 14:44 output_5gb

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-03 08:42 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d08b4dbf23febd3f305a2682b03ab9c70f11ac60
Log: Fix Bug #66736 	fpassthru broken
 [2014-04-03 08:42 UTC] mike@php.net
-Status: Open +Status: Closed
 [2014-04-05 08:34 UTC] ab@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d08b4dbf23febd3f305a2682b03ab9c70f11ac60
Log: Fix Bug #66736 	fpassthru broken
 [2014-04-05 08:35 UTC] ab@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d08b4dbf23febd3f305a2682b03ab9c70f11ac60
Log: Fix Bug #66736 	fpassthru broken
 [2014-04-10 04:47 UTC] tyrael@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d08b4dbf23febd3f305a2682b03ab9c70f11ac60
Log: Fix Bug #66736 	fpassthru broken
 [2014-10-07 23:15 UTC] stas@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=d08b4dbf23febd3f305a2682b03ab9c70f11ac60
Log: Fix Bug #66736 	fpassthru broken
 [2014-10-07 23:26 UTC] stas@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=d08b4dbf23febd3f305a2682b03ab9c70f11ac60
Log: Fix Bug #66736 	fpassthru broken
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 22:01:45 2024 UTC