php / php/php-src

memory leak readline

Open
#17,154 1 comment 0 reactions 1 assignee View on GitHub

@devnexen is already working on this.

Since Dec 14, 2024.

  • #17155 by @devnexen — open
Bug Extension: readline Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
readline_info('line_buffer', 'abcdef');
readline_write_history($name);

Resulted in this output:

==3505130==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x66c494 in strdup (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x66c494)
    #1 0x23683f1 in zif_readline_info /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/readline/readline.c:199:17
    #2 0x4484b19 in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:1299:2
    #3 0x3f7c237 in execute_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:58595:7
    #4 0x3f7e4bc in zend_execute /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:64247:2
    #5 0x4d151c9 in zend_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1934:3
    #6 0x35298da in php_execute_script_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2577:13
    #7 0x352aa18 in php_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2617:9
    #8 0x4d294da in do_cli /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:938:5
    #9 0x4d239bf in main /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:1313:18
    #10 0x7fa51f4fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
PHP Version

nightly

Operating System

ubuntu 22.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.