mirror of https://github.com/xiph/flac
Add abort on encoding error that should not happen
This commit lets the following errors trigger an abort: - FLAC__STREAM_ENCODER_OGG_ERROR - FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR - FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA - FLAC__STREAM_ENCODER_IO_ERROR - FLAC__STREAM_ENCODER_FRAMING_ERROR - FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR FLAC__STREAM_ENCODER_CLIENT_ERROR does not trigger an abort because it is used to signal invalid input. FLAC__STREAM_ENCODER_UNINITIALIZED does not trigger an abort because init fails when invalid parameters are given
This commit is contained in:
parent
6122337f73
commit
87a5f3e952
|
@ -238,6 +238,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||
}
|
||||
}
|
||||
|
||||
if(FLAC__stream_encoder_get_state(encoder) != FLAC__STREAM_ENCODER_OK &&
|
||||
FLAC__stream_encoder_get_state(encoder) != FLAC__STREAM_ENCODER_UNINITIALIZED &&
|
||||
FLAC__stream_encoder_get_state(encoder) != FLAC__STREAM_ENCODER_CLIENT_ERROR){
|
||||
fprintf(stderr,"-----\nERROR: stream encoder returned %s\n-----\n",FLAC__stream_encoder_get_resolved_state_string(encoder));
|
||||
abort();
|
||||
}
|
||||
|
||||
FLAC__stream_encoder_finish(encoder);
|
||||
|
||||
/* now that encoding is finished, the metadata can be freed */
|
||||
|
|
Loading…
Reference in New Issue