Closed Bug 2054240 Opened 3 months ago Closed 3 months ago

Fix bugprone-fold-init-type warnings in WebMDemuxer::GetNextPacket

Categories

(Core :: Audio/Video, task)

task

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

clang-tidy reports two bugprone-fold-init-type warnings in WebMDemuxer.cpp. The two std::accumulate calls in the MOZ_ASSERT verifying crypto sample sizes are initialized with 0 (an int) while folding over uint32_t elements of mPlainSizes and mEncryptedSizes, which folds unsigned int into int and risks loss of precision.

Fixed by using size_t{0} as the init value for both accumulations, which also matches the size_t type of length being compared against and removes the need for the explicit (size_t) cast.

Pushed by sledru@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/62c2a37fb6e8 https://hg.mozilla.org/integration/autoland/rev/02435c9d04ae Fix bugprone-fold-init-type warnings in WebMDemuxer::GetNextPacket r=media-playback-reviewers,chunmin
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
QA Whiteboard: [qa-triage-done-c155/b154]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: