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

Commit 657ea052 authored by Mark Salyzyn's avatar Mark Salyzyn Committed by android-build-merger
Browse files

Merge "stagefright: parseApp check data boundary conditions" am: ea73e1ae

am: 046ac31f

Change-Id: I31065509366a84f2f1bfd90ba1c3d9b3d91aa1bf
parents 2347a1f8 046ac31f
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -762,10 +762,16 @@ status_t RTPSender::parseTSFB(const uint8_t *data, size_t size) {
    return OK;
}

status_t RTPSender::parseAPP(const uint8_t *data, size_t size __unused) {
    if (!memcmp("late", &data[8], 4)) {
        int64_t avgLatencyUs = (int64_t)U64_AT(&data[12]);
        int64_t maxLatencyUs = (int64_t)U64_AT(&data[20]);
status_t RTPSender::parseAPP(const uint8_t *data, size_t size) {
    static const size_t late_offset = 8;
    static const char late_string[] = "late";
    static const size_t avgLatencyUs_offset = late_offset + sizeof(late_string) - 1;
    static const size_t maxLatencyUs_offset = avgLatencyUs_offset + sizeof(int64_t);

    if ((size >= (maxLatencyUs_offset + sizeof(int64_t)))
            && !memcmp(late_string, &data[late_offset], sizeof(late_string) - 1)) {
        int64_t avgLatencyUs = (int64_t)U64_AT(&data[avgLatencyUs_offset]);
        int64_t maxLatencyUs = (int64_t)U64_AT(&data[maxLatencyUs_offset]);

        sp<AMessage> notify = mNotify->dup();
        notify->setInt32("what", kWhatInformSender);