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_channels.c | |
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 '')
-rw-r--r-- | src/pcm_channels.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/pcm_channels.c b/src/pcm_channels.c index 4f9343912..38445f958 100644 --- a/src/pcm_channels.c +++ b/src/pcm_channels.c @@ -20,13 +20,8 @@ #include "pcm_channels.h" #include "pcm_buffer.h" -#include <glib.h> - #include <assert.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "pcm" - static void pcm_convert_channels_16_1_to_2(int16_t *dest, const int16_t *src, unsigned num_frames) @@ -92,11 +87,8 @@ pcm_convert_channels_16(struct pcm_buffer *buffer, else if (dest_channels == 2) pcm_convert_channels_16_n_to_2(dest, src_channels, src, num_frames); - else { - g_warning("conversion %u->%u channels is not supported", - src_channels, dest_channels); + else return NULL; - } return dest; } @@ -166,11 +158,8 @@ pcm_convert_channels_24(struct pcm_buffer *buffer, else if (dest_channels == 2) pcm_convert_channels_24_n_to_2(dest, src_channels, src, num_frames); - else { - g_warning("conversion %u->%u channels is not supported", - src_channels, dest_channels); + else return NULL; - } return dest; } @@ -235,11 +224,8 @@ pcm_convert_channels_32(struct pcm_buffer *buffer, else if (dest_channels == 2) pcm_convert_channels_32_n_to_2(dest, src_channels, src, num_frames); - else { - g_warning("conversion %u->%u channels is not supported", - src_channels, dest_channels); + else return NULL; - } return dest; } |