Skip to contentSkip to conversation

sbcenc: Add missing error check for unsupported sample rates

PATCH Applied Pali Rohár 2 participants 2 messages Aug 8, 2020 – Aug 11, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sbcenc: Add missing error check for unsupported sample rates

---
 src/sbcenc.c | 4 ++++
 1 file changed, 4 insertions(+)
src/sbcenc.c +4 -0
index dabdff4..2a4c240 100644
@@ -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);
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

Hi Pali,

Quoted 22 lines · Pali Rohár
---
 src/sbcenc.c | 4 ++++
 1 file changed, 4 insertions(+)
src/sbcenc.c +4 -1
index dabdff4..2a4c240 100644
@@ -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);
--
Quoted 1 line

2.20.1

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz