diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2017-01-31 06:39:22 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2017-01-30 21:50:51 +1100 |
commit | 006dcfbe23d56dc822574f9999b16adb1d32ec64 (patch) | |
tree | 2398187e8ea779d41f33d5d0da8479f431173d70 /src | |
parent | 33f093ae2f9d850dfa4dc3e7b60fba282731f894 (diff) | |
download | flac-006dcfbe23d56dc822574f9999b16adb1d32ec64.tar.gz |
FLAC__stream_encoder_finish: Sanity improvement
Previously this function would abort or crash if passed `NULL` for
the encoder. Now it just returns without crashing or aborting which
is far more sane behaviour (ie much like FLAC__stream_encoder_delete).
Diffstat (limited to 'src')
-rw-r--r-- | src/libFLAC/stream_encoder.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index dcdc70f0..1993ec5e 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -1439,7 +1439,9 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder) { FLAC__bool error = false; - FLAC__ASSERT(0 != encoder); + if (encoder == NULL) + return false; + FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->protected_); |