diff mbox series

sbcenc: Add missing error check for unsupported sample rates

Message ID 20200808193014.28951-1-pali@kernel.org (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series sbcenc: Add missing error check for unsupported sample rates | expand

Commit Message

Pali Rohár Aug. 8, 2020, 7:30 p.m. UTC
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 src/sbcenc.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Luiz Augusto von Dentz Aug. 11, 2020, 6:30 p.m. UTC | #1
Hi Pali,

On Sat, Aug 8, 2020 at 12:34 PM Pali Rohár <pali@kernel.org> wrote:
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  src/sbcenc.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/sbcenc.c b/src/sbcenc.c
> index dabdff4..2a4c240 100644
> --- a/src/sbcenc.c
> +++ b/src/sbcenc.c
> @@ -105,6 +105,10 @@ static void encode(char *filename, int subbands, int bitpool, int joint,
>                 case 48000:
>                         sbc.frequency = SBC_FREQ_48000;
>                         break;
> +               default:
> +                       fprintf(stderr, "Unsupported sample rate %ukHz\n",
> +                                       BE_INT(au_hdr.sample_rate));
> +                       goto done;
>                 }
>
>                 srate = BE_INT(au_hdr.sample_rate);
> --
> 2.20.1

Applied, thanks.
diff mbox series

Patch

diff --git a/src/sbcenc.c b/src/sbcenc.c
index dabdff4..2a4c240 100644
--- a/src/sbcenc.c
+++ b/src/sbcenc.c
@@ -105,6 +105,10 @@  static void encode(char *filename, int subbands, int bitpool, int joint,
 		case 48000:
 			sbc.frequency = SBC_FREQ_48000;
 			break;
+		default:
+			fprintf(stderr, "Unsupported sample rate %ukHz\n",
+					BE_INT(au_hdr.sample_rate));
+			goto done;
 		}
 
 		srate = BE_INT(au_hdr.sample_rate);