Closed Bug 2021178 Opened 8 months ago Closed 8 months ago

make buffer size validation functions in gfx/layers/ImageDataSerializer.h return Maybe<>

Categories

(Core :: Graphics, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 --- wontfix
firefox148 --- wontfix
firefox149 --- wontfix
firefox150 + fixed

People

(Reporter: tnikkel, Assigned: tschuster)

References

Details

(Keywords: sec-other, Whiteboard: [adv-main150-])

Attachments

(2 external files)

This is a followup to a review comment in bug 2020091.

We use various functions in ImageDataSerializer.h to validate buffer sizes (ComputeYCbCrBufferSize, ComputeRGBBufferSize, GetRGBStride, ComputeRGBStride, etc) which return 0 on error/overflow. Historically the code was not checking for 0 return value in some places (I already did an audit and fixed anything that didn't seem right). We should make it harder to not check for the error condition to avoid this happening again. Further, it was suggested we add logging/assertions in the error path.

Assignee: nobody → tschuster
Attached file (secure) —
Summary: make buffer size validation functions in gfx/layers/ImageDataSerializer.h return Result<> or Maybe<> → make buffer size validation functions in gfx/layers/ImageDataSerializer.h return Maybe<>
Keywords: sec-other
Keywords: leave-open

I just updated all of the GetAligned functions to return Maybe<> and there seem to be quite a few places where we weren't checking for 0 at all.

Attached file (secure) —
Blocks: 2023249
Pushed by tschuster@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1dc03331dd13 https://hg.mozilla.org/integration/autoland/rev/96617faea688 Return Maybe<uint32_t> from Compute*BufferSize. r=tnikkel,media-playback-reviewers,padenot https://github.com/mozilla-firefox/firefox/commit/601fafa65ba6 https://hg.mozilla.org/integration/autoland/rev/1ec4feda5059 Return Maybe<int32_t> from Get*Stride. r=tnikkel,media-playback-reviewers,webrtc-reviewers,webgpu-reviewers,bradwerth,ErichDonGubler,pehrsons,padenot
Keywords: leave-open
Target Milestone: --- → 150 Branch
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Group: gfx-core-security → core-security-release
QA Whiteboard: [sec] [qa-triage-done-c151/b150]
Whiteboard: [adv-main150-]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: