From f2ae760602a948598a168ad43673bfbd9d50fc6b Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 29 Apr 2013 13:17:50 -0700 Subject: [PATCH] A reference to the psi section data could become invalid if more sections were added to the KeyedVector. Change-Id: I095b5452ccfad89d69fc502fb21ce39495e201c3 related-to-bug: 8754565 --- media/libstagefright/mpeg2ts/ATSParser.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp index c12572fcb2..9850a46e43 100644 --- a/media/libstagefright/mpeg2ts/ATSParser.cpp +++ b/media/libstagefright/mpeg2ts/ATSParser.cpp @@ -1059,7 +1059,7 @@ status_t ATSParser::parsePID( ssize_t sectionIndex = mPSISections.indexOfKey(PID); if (sectionIndex >= 0) { - const sp §ion = mPSISections.valueAt(sectionIndex); + sp section = mPSISections.valueAt(sectionIndex); if (payload_unit_start_indicator) { CHECK(section->isEmpty()); @@ -1068,7 +1068,6 @@ status_t ATSParser::parsePID( br->skipBits(skip * 8); } - CHECK((br->numBitsLeft() % 8) == 0); status_t err = section->append(br->data(), br->numBitsLeft() / 8); @@ -1103,10 +1102,13 @@ status_t ATSParser::parsePID( if (!handled) { mPSISections.removeItem(PID); + section.clear(); } } - section->clear(); + if (section != NULL) { + section->clear(); + } return OK; } -- 2.11.0