Closed Bug 1426123 Opened 6 years ago Closed 6 years ago

Avoid spurious divide-by-zero warning from coverity for SelectSendResolution()

Categories

(Core :: WebRTC: Audio/Video, enhancement, P2)

55 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: jesup, Assigned: jesup)

Details

Attachments

(1 file)

Note that this can't actually happen in practice - the logic is such that it will never pass 0's to SelectSendResolution().  Add and assert and some comments to this effect.

________________________________________________________________________________________________________
*** CID 1426699:  Integer handling issues  (DIVIDE_BY_ZERO)
/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp: 1968 in mozilla::WebrtcVideoConduit::SendVideoFrame(const webrtc::VideoFrame &)()
1962           // Waiting for it to finish
1963           return kMediaConduitNoError;
1964         }
1965         if (frame.width() != mLastWidth || frame.height() != mLastHeight) {
1966           CSFLogVerbose(LOGTAG, "%s: call SelectSendResolution with %ux%u",
1967                         __FUNCTION__, frame.width(), frame.height());
>>>     CID 1426699:  Integer handling issues  (DIVIDE_BY_ZERO)
>>>     In function call "SelectSendResolution", division by expression "frame->width()" which may be zero has undefined behavior.
1968           if (SelectSendResolution(frame.width(), frame.height(), &frame)) {
1969             // SelectSendResolution took ownership of the data in i420_frame.
1970             // Submit the frame after reconfig is done
1971             return kMediaConduitNoError;
1972           }
1973         }
Attachment #8937714 - Flags: review?(jib) → review+
Rank: 15
Priority: -- → P2
Pushed by rjesup@wgate.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/cb2631ae4b75
add assertion and comments that SelectSendResolution() can never result in divide-by-zero r=jib
https://hg.mozilla.org/mozilla-central/rev/cb2631ae4b75
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: