php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79410 system() swallows last chunk if it is exactly 4095 bytes without newline
Submitted: 2020-03-23 20:41 UTC Modified: 2020-03-24 22:59 UTC
From: cschneid@php.net Assigned:
Status: Closed Package: Program Execution
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cschneid@php.net
New email:
PHP Version: OS:

 

 [2020-03-23 20:41 UTC] cschneid@php.net
Description:
------------
When executing a program where the output's last chunk is 4095 bytes then the last chunk is swallowed.
The script below generates 4095 dots on Linux and counts how many system()'s output contain.
None of the dots reach the output, a patch resolving this issue is attached.
The bug could already be reproduced in 5.3.0, I did not trace it back farther than that.

Test script:
---------------
# Execute command print 4095 dots
php -r 'system("printf .%.0s {1..4095}");'  | wc -c

Expected result:
----------------
4095

Actual result:
--------------
0

Patches

system_4095_bytes.patch (last revision 2020-03-25 08:23 UTC by cschneid@php.net)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-24 22:59 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2020-03-24 23:00 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix Bug #79410 and add test for it
On GitHub:  https://github.com/php/php-src/pull/5292
Patch:      https://github.com/php/php-src/pull/5292.patch
 [2020-03-25 08:23 UTC] cschneid@php.net
The following patch has been added/updated:

Patch Name: system_4095_bytes.patch
Revision:   1585124605
URL:        https://bugs.php.net/patch-display.php?bug=79410&patch=system_4095_bytes.patch&revision=1585124605
 [2020-03-25 09:51 UTC] nikic@php.net
Automatic comment on behalf of schneider@search.ch
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c0840fec9c28bf0133391e4d0a9a4d8dbf4e9967
Log: Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
 [2020-03-25 09:51 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC