Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: backport b52f7fb5933a from WebRTC. #23045

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

ppontes
Copy link
Member

@ppontes ppontes commented Apr 9, 2020

Description of Change

[DirectX] Fix vector allocation for raw data handling.

std::vector::reserve has the effect to reserve space in memory but does
not affect the result of size(), which keeps on returning 0. If size is
0, however, data() might either return null or not [1].

This CL fixes the use of reserve() in favour of resize() which
effectively allocates the memory in the vector and updates its size.
This way size() returns a value bigger than 0 and data() returns a valid
pointer.

[1] https://en.cppreference.com/w/cpp/container/vector/data

Fixed: chromium:1059764
Change-Id: Ida3dbe643710c6895f09b9da87b0075b7d7b28df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170470
Reviewed-by: Jamie Walch jamiewalch@chromium.org
Commit-Queue: Armando Miraglia armax@webrtc.org
Cr-Commit-Position: refs/heads/master@{#30836}

Release Notes

Notes: Security: backported the fix to CVE-2020-6452: potential container-overflow in MediaStream mojo.

@ppontes ppontes added 6-1-x backport-check-skip Skip trop's backport validity checking labels Apr 9, 2020
@ppontes ppontes requested a review from a team April 9, 2020 00:01
@ppontes ppontes requested a review from a team as a code owner April 9, 2020 00:01
[DirectX] Fix vector allocation for raw data handling.

std::vector::reserve has the effect to reserve space in memory but does
not affect the result of size(), which keeps on returning 0. If size is
0, however, data() might either return null or not [1].

This CL fixes the use of reserve() in favour of resize() which
effectively allocates the memory in the vector and updates its size.
This way size() returns a value bigger than 0 and data() returns a valid
pointer.

[1] https://en.cppreference.com/w/cpp/container/vector/data

Fixed: chromium:1059764
Change-Id: Ida3dbe643710c6895f09b9da87b0075b7d7b28df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170470
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Armando Miraglia <armax@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30836}
@jkleinsc jkleinsc force-pushed the ppontes/backport-webrtc-b52f7fb5933a-to-6-1-x branch from d497234 to aa14b75 Compare April 13, 2020 16:56
@jkleinsc
Copy link
Contributor

Merging as CI failures unrelated to PR change

@jkleinsc jkleinsc merged commit 0f67fac into 6-1-x Apr 14, 2020
@release-clerk
Copy link

release-clerk bot commented Apr 14, 2020

Release Notes Persisted

Security: backported the fix to CVE-2020-6452: potential container-overflow in MediaStream mojo.

@jkleinsc jkleinsc deleted the ppontes/backport-webrtc-b52f7fb5933a-to-6-1-x branch April 14, 2020 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6-1-x backport-check-skip Skip trop's backport validity checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants