Closed Bug 1216059 Opened 5 years ago Closed 5 years ago

SourceMediaStream::TrackData::mResamplerChannelCount is used uninitialised

Categories

(Core :: DOM: Device Interfaces, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: jseward, Unassigned)

Details

Attachments

(2 files)

This is visible in at least the following test cases:

dom/media/test/test_mediarecorder_record_gum_video_timeslice.html
dom/media/test/test_streams_element_capture_playback.html
dom/media/tests/mochitest/identity/test_fingerprints.html
dom/media/tests/mochitest/identity/test_peerConnection_asymmetricIsolation.html

STR: in an --enable-valgrind --disable-jemalloc build, run

./mach mochitest --valgrind=/usr/bin/valgrind \
   dom/media/tests/mochitest/identity/test_peerConnection_asymmetricIsolation.html

The problem occurs because SourceMediaStream::AddTrackInternal doesn't
initialise data->mResamplerChannelCount.  I assume that the call
track_data->AppendElement() creates a new TrackData that is initialised
by TrackData's default constructor, since I see no other constructor for
it.  But presumably a default constructor wouldn't initialise a plain |int|
field.  Maybe TrackData needs a non-default constructor now?

NB: there is more than one TrackData class/struct, which is confusing.
The one I refer to here is at dom/media/MediaStreamGraph.h:855.
Possibly related to Bug 901633 "Part 13" ?
This stops V complaining by initialising the relevant field in
SourceMediaStream::AddTrackInternal.  Per comments in comment 0 about
default constructors, I don't think this is a particularly good
solution, but it does work.
Attachment #8675549 - Flags: feedback?(padenot)
Comment on attachment 8675549 [details] [diff] [review]
bug1216059-1.diff

Review of attachment 8675549 [details] [diff] [review]:
-----------------------------------------------------------------

That's fine, thanks.
Attachment #8675549 - Flags: feedback?(padenot) → review+
https://hg.mozilla.org/mozilla-central/rev/73b53d0fb12e
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.