From 0fb877740b84f6831d417a4afca065a3a3f86a41 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 Nov 2009 21:02:52 +0100 Subject: decoder/flac: check "seekable" in libFLAC callbacks Return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED if this input stream does not support seeking. --- src/decoder/flac_plugin.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 2d14ab9df..427d2c4d9 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -69,6 +69,9 @@ flac_seek_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd, { struct flac_data *data = (struct flac_data *) fdata; + if (!data->input_stream->seekable) + return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; + if (!input_stream_seek(data->input_stream, offset, SEEK_SET)) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; @@ -81,6 +84,9 @@ flac_tell_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd, { struct flac_data *data = (struct flac_data *) fdata; + if (!data->input_stream->seekable) + return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; + *offset = (long)(data->input_stream->offset); return FLAC__STREAM_DECODER_TELL_STATUS_OK; -- cgit v1.2.3