Closed
Bug 1298275
Opened 8 years ago
Closed 8 years ago
FlacFrameParser's AutoByteReader has a virtual destructor when its superclass doesn't
Categories
(Core :: Audio/Video: Playback, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
References
Details
Attachments
(1 file)
ByteReader's destructor is not virtual. AutoByteReader inherits from ByteReader, but declares its destructor virtual. AutoByteReader is only used as a stack object in FlacFrameParser.cpp, so it's not a big problem at the moment, just a bit wasteful. But if it was exposed to a wider audience (e.g., after bug 1298271), this could be ripe for abuse, e.g., if an AutoByteReader was stored in a pointer-to-ByteReader, the wrong destructor would be called. So either we can make ~ByteReader virtual too, or make both non-virtual if we can ensure AutoByteReader won't get stored into a ByteReader*.
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → gsquelart
Comment 2•8 years ago
|
||
mozreview-review |
Comment on attachment 8785183 [details] Bug 1298275 - Make ~AutoByteReader non-virtual - https://reviewboard.mozilla.org/r/74480/#review72344 ::: media/libstagefright/binding/include/mp4_demuxer/ByteReader.h:19 (Diff revision 1) > > +MOZ_RAII > class ByteReader > { > public: > ByteReader() : mPtr(nullptr), mRemaining(0) {} Wouldn't it be easier to mark ~ByteReader as virtual?
Attachment #8785183 -
Flags: review?(jyavenard) → review+
Assignee | ||
Comment 3•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8785183 [details] Bug 1298275 - Make ~AutoByteReader non-virtual - https://reviewboard.mozilla.org/r/74480/#review72344 Thank you for the quick review. > Wouldn't it be easier to mark ~ByteReader as virtual? But it would be so inefficient! Also ByteReader points at an external buffer, so enforcing it to be an on-stack object prevents it being stored somewhere where it could outlive the external buffer.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a9b5e8c3cd84 Make ~AutoByteReader non-virtual - r=jya
Updated•8 years ago
|
Priority: -- → P3
Comment 7•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a9b5e8c3cd84
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•