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

Commit ff8b0234 authored by Jinguang Dong's avatar Jinguang Dong Committed by Robert Shih
Browse files

HTTPLIVE: do not store hash of malformed M3U8 file

From code analysis, we should make sure that M3UParser::initCheck
returns OK then perform hash memcpy. This would prevent NuPlayer from
overlooking a malformed M3U8 and crashing later on a NULL derefernce.

Test: 1 Play http://117.34.15.47/7d.v.iask.com/player/ovs1_idx_chid_1054589_br_400_fn_4_pn_weitv_sig_md5.m3u8
      2 mediaserver does not crash

Bug: 33763371
Change-Id: I3d8f5450cdf45288110121973c679c8d58210d5c
parent 24cd6995
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -256,10 +256,6 @@ sp<M3UParser> HTTPDownloader::fetchPlaylist(

        return NULL;
    }

    if (curPlaylistHash != NULL) {
        memcpy(curPlaylistHash, hash, sizeof(hash));
    }
#endif

    sp<M3UParser> playlist =
@@ -271,6 +267,13 @@ sp<M3UParser> HTTPDownloader::fetchPlaylist(
        return NULL;
    }

#if defined(__ANDROID__)
    if (curPlaylistHash != NULL) {

        memcpy(curPlaylistHash, hash, sizeof(hash));
    }
#endif

    return playlist;
}