Add FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA

This commit is contained in:
Martijn van Beurden 2022-04-13 10:49:03 +02:00
parent 0077d3b697
commit 1ca7b38f3c
2 changed files with 12 additions and 4 deletions

View File

@ -422,7 +422,11 @@ extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
* could be because the decoder encountered a valid frame made by a future
* version of the encoder which it cannot parse, or because of a false
* sync making it appear as though an encountered frame was generated by
* a future encoder.
* a future encoder. \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA is
* caused by finding data that doesn't fit a metadata block (too large
* or too small) or finding inconsistencies in the metadata, for example
* a PICTURE block with an image that exceeds the size of the metadata
* block.
*/
typedef enum {
@ -435,9 +439,12 @@ typedef enum {
FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
/**< The frame's data did not match the CRC in the footer. */
FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM,
/**< The decoder encountered reserved fields in use in the stream. */
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA
/**< The decoder encountered a corrupted metadata block. */
} FLAC__StreamDecoderErrorStatus;
/** Maps a FLAC__StreamDecoderErrorStatus to a C string.

View File

@ -230,7 +230,8 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = {
"FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC",
"FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER",
"FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH",
"FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM"
"FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM",
"FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA"
};
/***********************************************************************
@ -1508,7 +1509,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
/* Content in metadata block didn't fit in block length
* We cannot know whether the length or the content was
* corrupt, so stop parsing metadata */
send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA);
decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
ok = false;
}