Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 491d09a1 authored by Leena Winterrowd's avatar Leena Winterrowd Committed by Gerrit - the friendly Code Review server
Browse files

libstagefright: httplive: Add NULL check for empty playlist

If the source playlist is empty, the playlist meta will be NULL.
Check for this case to avoid an invalid dereference. Also flag
playlists without the required EXT-X-TARGETDURATION tag as malformed.

CRs-Fixed: 736089
Change-Id: Idf74d890a89bbc6483a6d4060eb092dc7461be24
parent d9b04af0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -610,7 +610,12 @@ void PlaylistFetcher::onMonitorQueue() {
    int32_t targetDurationSecs;
    int64_t targetDurationUs = kMinBufferedDurationUs;
    if (mPlaylist != NULL) {
        CHECK(mPlaylist->meta()->findInt32("target-duration", &targetDurationSecs));
        if (mPlaylist->meta() == NULL || !mPlaylist->meta()->findInt32(
                "target-duration", &targetDurationSecs)) {
            ALOGE("Playlist is missing required EXT-X-TARGETDURATION tag");
            notifyError(ERROR_MALFORMED);
            return;
        }
        targetDurationUs = targetDurationSecs * 1000000ll;
    }