Skip to content

Memory Leak #18139

Open
Open
@chongwick

Description

@chongwick

Description

The following code:

<?php
define("MAX_64Bit", 9223372036854775807);
define("MAX_32Bit", 2147483647);
define("MIN_64Bit", -9223372036854775807 - 1);
define("MIN_32Bit", -2147483647 - 1);

$longVals = array(
    MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
    MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
    MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
);

foreach ($longVals as $longVal) {
   var_dump(readline_info('readline_name', 1));
}

?>

Resulted in this output:

==1296481==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 28 byte(s) in 14 object(s) allocated from:
    #0 0x151407c2b9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x561486e92e7c in zif_readline_info /home/w023dtc/nightly_php/php-src/ext/readline/readline.c:277
    #2 0x561487bb47cc in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:1363
    #3 0x561487bb47cc in execute_ex /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:58820
    #4 0x561487bf4b0f in zend_execute /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:64247
    #5 0x561487db7bef in zend_execute_script /home/w023dtc/nightly_php/php-src/Zend/zend.c:1941
    #6 0x5614875601e3 in php_execute_script_ex /home/w023dtc/nightly_php/php-src/main/main.c:2584
    #7 0x561487dbd285 in do_cli /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:938
    #8 0x561486148c32 in main /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:1313
    #9 0x151403e82d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)

SUMMARY: AddressSanitizer: 28 byte(s) leaked in 14 allocation(s).

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions