Closed Bug 1325189 Opened 9 years ago Closed 9 years ago

[CID 1221158] Missing OOM check in stagefright::MetaData::setData

Categories

(Core :: Audio/Video: Playback, defect, P1)

49 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: mozbugz, Assigned: JamesCheng)

Details

(Whiteboard: CID 1221158)

Attachments

(1 file)

Found by Coverity, CID 1221158. In stagefright::MetaData::setData(): After `ssize_t i = ... mItems.add(key, item);`, i could now be negative in case of OOM when trying to add the key. But anyway, going down the rabbit hole, the actual place where memory is (re)allocated in VectorImpl::_grow() is followed by an assert, so in case of OOM the program will crash before anything can be done with the finally-returned negative value! For safety's sake, we should probably add a check in setData anyway, and if time permit see if there is a better way to deal with OOMs in the storage.
Attachment #8821026 - Flags: review?(gsquelart)
Assignee: gsquelart → jacheng
Comment on attachment 8821026 [details] Bug 1325189 - [CID 1221158] Assertion when OOM instead of indexing array with negative value. https://reviewboard.mozilla.org/r/100398/#review100998 Thank you for handling this one. r+ with nits: ::: media/libstagefright/frameworks/av/media/libstagefright/MetaData.cpp:197 (Diff revision 1) > i = mItems.add(key, item); > Remove these redundant lines. ::: media/libstagefright/frameworks/av/media/libstagefright/MetaData.cpp:199 (Diff revision 1) > + // TODO: "i" will be negtive value when OOM, > + // we should consider to handle this case instead of assertion. 'negtive' -> 'negative' 'to handle' -> 'handling' 'assertion' -> 'asserting'
Attachment #8821026 - Flags: review?(gsquelart) → review+
Thank you for pointing out! Thanks.
Pushed by jacheng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e594cf0fda6d [CID 1221158] Assertion when OOM instead of indexing array with negative value. r=gerald
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: