php_embed_ub_write does not return on error
还没有人认领这个 Issue。
评估
调研方向
从 sapi/embed/php_embed.c 中的 php_embed_ub_write 开始,跟踪 php_embed_single_write 的错误路径以及随后执行的 php_handle_aborted_connection。验证当连接未中止时,零字节写入不会无限重复。完成标准是该函数在发生错误后返回已写入的字节数,而不是无限循环。
由索引模型根据 Issue 内容生成。
描述
Description
sapi/embed/php_embed.c:
/* SAPIs only have unbuffered write operations. This is because PHP's output
* buffering feature will handle any buffering of the output and invoke the
* SAPI unbuffered write operation when it flushes the buffer.
*/
static size_t php_embed_ub_write(const char *str, size_t str_length)
{
const char *ptr = str;
size_t remaining = str_length;
size_t ret;
while (remaining > 0) {
ret = php_embed_single_write(ptr, remaining);
if (!ret) {
php_handle_aborted_connection();
}
ptr += ret;
remaining -= ret;
}
return str_length;
}
php_handle_aborted_connection does not always abort, i.e. if ignore_user_abort=1. So I sending fails and ret is 0, then remaining is never decremented and this loops forever.
It should probably return str_length - remaining after php_handle_aborted_connection().
PHP Version
master
Operating System
No response
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 103
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
Bug SAPI: cli_server Status: Verified
难度 2/5 1-3 小时 新手友好度 88/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 76/100
-
Bug Status: Needs Triage
难度 1/5 1 小时以内 新手友好度 90/100
-
Bug Category: Tests Status: Verified
难度 2/5 1-3 小时 新手友好度 68/100
-
Bug SAPI: fpm Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 65/100
相似的 Issue
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
HarbourMasters/Shipwright#7229 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 条评论 ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 76/100