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

Commit 5cf91c50 authored by Leena Winterrowd's avatar Leena Winterrowd Committed by Lajos Molnar
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.

Bug: 18821145
Change-Id: Idf74d890a89bbc6483a6d4060eb092dc7461be24
parent f0d68993
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -610,7 +610,12 @@ void PlaylistFetcher::onMonitorQueue() {
    int32_t targetDurationSecs;
    int32_t targetDurationSecs;
    int64_t targetDurationUs = kMinBufferedDurationUs;
    int64_t targetDurationUs = kMinBufferedDurationUs;
    if (mPlaylist != NULL) {
    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;
        targetDurationUs = targetDurationSecs * 1000000ll;
    }
    }