commit 5b472438c934c46916c30e5740926fddd391af11
parent 2e38a41b0915c7d2e35e6155d6d19ca354011524
Author: Frederic Cambus <fred@statdns.com>
Date: Thu, 21 Feb 2019 22:04:03 +0100
Add more format validation checks for WAVE files.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/wav2gba.c b/wav2gba.c
@@ -74,6 +74,11 @@ int main(int argc, char *argv[]) {
fread(input_file_buffer, input_file_size, 1, input_file);
fclose(input_file);
+ if (input_file_size < WAVE_HEADER_LENGTH) {
+ printf("ERROR: Input File is not a WAV file\n\n");
+ return -1;
+ }
+
/* Check that the file is a valid 8-bit MONO WAV */
memcpy(&wave_header, input_file_buffer, WAVE_HEADER_LENGTH);