Skip to content
Snippets Groups Projects
Commit 14c5c469 authored by Petter Reinholdtsen's avatar Petter Reinholdtsen
Browse files

Improve encoder example to reject audio without any channels.

This avoid a crash on bogus input, just exit with a message instead.

Fixes #2305
parent 14045376
No related branches found
No related tags found
No related merge requests found
Pipeline #6136 passed
......@@ -33,6 +33,7 @@
#endif
/*#define OC_COLLECT_METRICS*/
#include <assert.h>
#include <stdio.h>
#if !defined(_WIN32)
#include <getopt.h>
......@@ -775,6 +776,10 @@ static void id_file(char *f){
audio=test;
audio_ch=buffer[6]+(buffer[7]<<8);
if (0 >= audio_ch) {
fprintf(stderr,"Can only read WAV files with non-zero audio channels for now.\n");
exit(1);
}
audio_hz=buffer[8]+(buffer[9]<<8)+
(buffer[10]<<16)+(buffer[11]<<24);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment