-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't call
alloc
with a length of 0 (#1027)
Ref denoland/deno#27545. Fixes a leak in deno.serve with an empty response. We would call `to_string_ptr` with an empty string and then call alloc with a length of 0 which is UB. Instead of using `alloc` directly, which has a large number of invariants to uphold, I've changed to just use `Vec` APIs. That leaves us with fewer invariants to uphold, handles the tricky cases for us, and we need to make a `Vec` eventually anyway (since `String` just wraps a Vec).
- Loading branch information
1 parent
48492d1
commit 726b802
Showing
1 changed file
with
20 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters