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

Commit 2568200f 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: 401a55cb am: 7352adcb

parents 41a4b9df 7352adcb
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)) {