diff options
author | Max Kellermann <max@duempel.org> | 2009-07-23 12:01:03 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-07-23 12:01:03 +0200 |
commit | 54889c72e3469027a852d9e8ff029d659e612094 (patch) | |
tree | 19864296a3807db7b0384d8052c4b12775c33ba6 /src/pcm_convert.h | |
parent | cba126ceb8f1830614a8df04a6b4c1a45f955417 (diff) | |
download | mpd-54889c72e3469027a852d9e8ff029d659e612094.tar.gz mpd-54889c72e3469027a852d9e8ff029d659e612094.tar.xz mpd-54889c72e3469027a852d9e8ff029d659e612094.zip |
pcm_convert: use GError for error handling
Don't abort the whole MPD process when the conversion fails. This has
been a denial-of-service attack vector for years.
Diffstat (limited to 'src/pcm_convert.h')
-rw-r--r-- | src/pcm_convert.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pcm_convert.h b/src/pcm_convert.h index a048d6598..7ef0782df 100644 --- a/src/pcm_convert.h +++ b/src/pcm_convert.h @@ -46,6 +46,12 @@ struct pcm_convert_state { struct pcm_buffer byteswap_buffer; }; +static inline GQuark +pcm_convert_quark(void) +{ + return g_quark_from_static_string("pcm_convert"); +} + /** * Initializes a pcm_convert_state object. */ @@ -66,13 +72,16 @@ void pcm_convert_deinit(struct pcm_convert_state *state); * @param src_size the size of #src in bytes * @param dest_format the requested destination audio format * @param dest_size_r returns the number of bytes of the destination buffer - * @return the destination buffer + * @param error_r location to store the error occuring, or NULL to + * ignore errors + * @return the destination buffer, or NULL on error */ const void * pcm_convert(struct pcm_convert_state *state, const struct audio_format *src_format, const void *src, size_t src_size, const struct audio_format *dest_format, - size_t *dest_size_r); + size_t *dest_size_r, + GError **error_r); #endif |