Repository navigation
Conversation
decodeWithMemoryBlock captured the raw ArrayBuffer data pointer in the async decode job. JSI only guarantees that pointer during the host call, so the worker could read freed memory once the buffer was collected. Copy the bytes into the job, matching AudioFileUtilsHostObject::probeDuration.
WPT non-regression comparisonPASS — no regressions · 0 improved section(s) · overall 3430 → 3430 (0) Unchanged sections (28)
Baseline: Workflow run · this comment is updated on every push. |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1431
Introduced changes
AudioDecoderHostObject::decodeWithMemoryBlocknow copies the encoded bytes into the async decode job instead of capturing the rawArrayBufferdata pointer. Before this, the worker could read freed memory if the JS buffer was collected while decoding.AudioFileUtilsHostObject::probeDuration(bytes = std::vector<uint8_t>(data, data + size)).Checklist
Tests: the test CMake excludes
HostObjects/, so there's no unit test here. I ran the following instead:clang++ -std=c++20 -fsyntax-onlyon the changed file, with React Native 0.86.3 JSI headers: passes.clang-format --dry-run --Werrorandcpplintwith the flags fromscripts/cpplint.sh: clean.heap-use-after-free; the copied capture passes.