Skip to content

The file /php-src/Zend/Optimizer/escape_analysis.c has a memory leak defect at line 417 #15020

Closed

Description

@LuMingYinDetect

Description

In the file /php-src/Zend/Optimizer/escape_analysis.c, at line 387, a pointer variable named ees is defined. At line 411, this variable allocates a dynamic memory area using the do_alloca function. If the conditional statement at line 412 evaluates to false, it indicates that the dynamic memory allocation pointed to by ees was successful. However, if the conditional statement at line 416 evaluates to true, the function will return at line 417, bypassing the deallocation of the dynamic memory area pointed to by ees at line 532. This situation constitutes a memory leak, as illustrated in the diagram below:
https://github.com/LuMingYinDetect/php_defects/blob/main/php_1.png

PHP Version

PHP 8.4.0

Operating System

Ubuntu 22.04

Activity

  1. added a commit that references this issue on Jul 19, 2024
    c1213cd
  2. added 2 commits that reference this issue on Jul 19, 2024
    03d7318
    f21947a
  3. added a commit that references this issue on Jul 19, 2024
    442ae96
  4. Bilge commented on Aug 29, 2024

    @Bilge

    Is this some kind of bot?

  5. ndossche commented on Aug 29, 2024

    @ndossche
    Member

    While there are certainly bots like these, I think this is a real person using static analysis, given the varying wording between the issues.

  6. Bilge commented on Aug 29, 2024

    @Bilge

    Why don't we have his static analysis tools? 😆

  7. ndossche commented on Aug 29, 2024

    @ndossche
    Member

    Actually, I sometimes run static analysis tools on PHP. That's how I started in my early contribution days actually.
    I even experiment with my own tools on PHP.

  8. LuMingYinDetect commented on Aug 30, 2024

    @LuMingYinDetect
    Author

    Actually, I sometimes run static analysis tools on PHP. That's how I started in my early contribution days actually.
    I even experiment with my own tools on PHP.

    This is a tool I improved based on the Clang Static Analyzer, and I am planning to submit a paper on it. I will open-source the tool in the paper!

  9. LuMingYinDetect commented on Aug 30, 2024

    @LuMingYinDetect
    Author

    Why don't we have his static analysis tools? 😆

    This is a tool I improved based on the Clang Static Analyzer, and I am planning to submit a paper on it. I will open-source the tool in the paper!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions