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

Commit 3c5c711d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix null dereference in Metadataretriever_fuzzer" into main am:...

Merge "Fix null dereference in Metadataretriever_fuzzer" into main am: 401a55cb am: 7352adcb am: 2568200f

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2892621



Change-Id: I70cfe5f5c5c7de0470dae0c1c9cd7c8971c82420
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents cb4edcda 2568200f
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -198,7 +198,9 @@ void CharacterEncodingDetector::detectAndConvert() {
            ALOGV("@@@ checking %s", name);
            const char *s = mValues.getEntry(i);
            int32_t inputLength = strlen(s);
            const char *enc;
            // Use encoding determined from the combination of artist/album/title etc.
            // as default if there is no better match found.
            const char *enc = combinedenc;

            if (!allprintable && (!strcmp(name, "artist") ||
                    !strcmp(name, "albumartist") ||
@@ -216,13 +218,12 @@ void CharacterEncodingDetector::detectAndConvert() {
                    const UCharsetMatch** ucma = ucsdet_detectAll(csd, &matches, &status);
                    const UCharsetMatch* bestSingleMatch = getPreferred(s, inputLength,
                            ucma, matches, &goodmatchSingle, &highestSingle);
                    // getPreferred could return a null. Check for null before calling
                    // ucsdet_getName.
                    if (bestSingleMatch != NULL) {
                        if (goodmatchSingle || highestSingle > highest)
                            enc = ucsdet_getName(bestSingleMatch, &status);
                    else
                        enc = combinedenc;
                } else {
                    // use encoding determined from the combination of artist/album/title etc.
                    enc = combinedenc;
                    }
                }
            } else {
                if (isPrintableAscii(s, inputLength)) {