Skip to content

FLAC Source does not handle error callback, which may lead to uninitialized flac_source and UB #80

@wro-ableton

Description

@wro-ableton

Hey!

We encountered an issue we can reproduce with a specific .flac file. (I'm trying to figure out if I can share it here.)

Basically in flac_source.h, FLAC__stream_decoder_process_until_end_of_metadata triggers the error_callback with FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC and then continues to return true. ni-media interprets this as "OK" as the function (FLAC__stream_decoder_process_until_end_of_metadata) has done what it says it will do.

However, this means, the metadata setup function metadataCallbackImpl is never called and audio::ifstream_info m_info stays uninitialized. Interacting with the stream after this point to my understanding ends in undefined behavior.

To my understanding, implementing the error_callback to throw at the end of the constructor of flac_source should prevent at least this undefined behavior.

Hope this issue can be addressed.
Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions