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

Commit 7c2c708e authored by David LONY's avatar David LONY
Browse files

stagefright: avoid crash when histogram option is used

if decodeTimesUs vector is null then it will lead to a segfault when decodeTimesUs->itemAt is called

Test: stagefright -x -S -s <a_video_file>; stagefright -x -S -r <a_video_file>; stagefright -x -s <a_video_file>

Change-Id: I3a5f283d3eecfefa3bdb9ad84385697ab3b1738e
parent 60cbc2b5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -106,6 +106,12 @@ static void displayDecodeHistogram(Vector<int64_t> *decodeTimesUs) {
    decodeTimesUs->sort(CompareIncreasing);

    size_t n = decodeTimesUs->size();

    if (n == 0) {
        printf("no decode histogram to display\n");
        return;
    }

    int64_t minUs = decodeTimesUs->itemAt(0);
    int64_t maxUs = decodeTimesUs->itemAt(n - 1);