Skip to content

UTF-16 files detected as MP3 due to frame sync check #14

@MadafakinRio

Description

@MadafakinRio

Hey, I ran into an issue with this line of code while scanning my music folder.

if (data.Length >= 2 && data[0] == 0xFF && (data[1] & 0xE0) == 0xE0)

This condition also matches some non-MP3 files.

For example, desktop.ini files on Windows are often encoded as UTF-16 LE and start with the byte order mark FF FE.
Since 0xFE & 0xE0 == 0xE0, the check evaluates to true and the file is detected as MP3.

So any UTF-16 LE text file could potentially trigger this.

Maybe the MP3 detection could validate additional header bits to avoid false positives.

Thanks for the library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions