Skip to content

Reading a string offset past the end of a string leaks a fresh empty string per read. #388

Closed

Description

@blacktrs

Summary

Reading a string offset past the end of a string leaks a fresh empty string per read.

Repro

<?php
function t(array $p): int { $c = $p['v']; $x = @$c[0]; return strlen($x); }
$p = ['k' => 1, 'v' => ''];
t($p);
$b = memory_get_usage();
for ($i = 0; $i < 50000; $i++) { t($p); }
echo (memory_get_usage() - $b) < 500000 ? "flat" : "leak", "\n";

Expected (php)

flat

Actual (manticore 96d0daa4, Darwin arm64)

leak

Tracking

Known-bug repro: tests/aot/repro/leak/str_offset_oob_read_leaks.php — bash tests/aot/xfail.sh -k str_offset_oob_read_leaks reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    leak
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugleak

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions