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

Commit 6a572dc6 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan
Browse files

FLACExtractor: Don't check size of first STREAMINFO

The size of the first STREAMINFO is not necessarily 042, as some
encoders may fill it with padding. The metadata parser handles
premature EOF just fine, so we don't need to be strict about it.

Change-Id: Ic077633c2622bb54402cdd8f04d30cd2b7776727
parent 28bc5a5b
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -793,13 +793,9 @@ bool SniffFLAC(
        const sp<DataSource> &source, String8 *mimeType, float *confidence,
        const sp<DataSource> &source, String8 *mimeType, float *confidence,
        sp<AMessage> *)
        sp<AMessage> *)
{
{
    // first 4 is the signature word
    uint8_t header[4];
    // second 4 is the sizeof STREAMINFO
    // 042 is the mandatory STREAMINFO
    // no need to read rest of the header, as a premature EOF will be caught later
    uint8_t header[4+4];
    if (source->readAt(0, header, sizeof(header)) != sizeof(header)
    if (source->readAt(0, header, sizeof(header)) != sizeof(header)
            || memcmp("fLaC\0\0\0\042", header, 4+4))
            || memcmp("fLaC", header, 4))
    {
    {
        return false;
        return false;
    }
    }