dmd icon indicating copy to clipboard operation
dmd copied to clipboard

fix #20508 escaping sliced stack arrays not detected

Open WalterBright opened this issue 3 weeks ago • 6 comments

WalterBright avatar Dec 09 '25 05:12 WalterBright

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#22207"

dlang-bot avatar Dec 09 '25 05:12 dlang-bot

m_lock.performLocked!({ m_streamWSize[sid] = newWin; });

  | ^   | ../.dub/packages/vibe-http/1.3.1/vibe-http/source/vibe/http/internal/http2/exchange.d(84,9): Error: returning scope variable res is not allowed in a @safe function

Anyone know anything about this code?

WalterBright avatar Dec 09 '25 06:12 WalterBright

@dkorpel may need to enable this with an edition

WalterBright avatar Dec 09 '25 06:12 WalterBright

may need to enable this with an edition

If you guard the code with if (sc.hasEdition(Edition.v2024)) it will only take effect from that edition onwards.

dkorpel avatar Dec 09 '25 10:12 dkorpel

Anyone know anything about this code?

https://github.com/vibe-d/vibe-http/blob/94e4d1fe6c5eace1de38456a79040c5e94b422e7/source/vibe/http/internal/http2/exchange.d#L55

It looks like it incorrectly marks the allocator parameter as scope instead of return scope in a @safe function, which should be an error but it passes because it's not compiled with -preview=dip1000. This PR restricts returning scope variables even without dip1000, so it now breaks.

dkorpel avatar Dec 09 '25 10:12 dkorpel

@dkorpel I added the edition check, thanks!

WalterBright avatar Dec 10 '25 07:12 WalterBright

This is ready to go.

WalterBright avatar Dec 10 '25 19:12 WalterBright