shithub: aacdec

Download patch

ref: 38102697777d9a8a1c6b70e9b86f3eb95cdcac04
parent: 793d77ad81eb0782fa91dd6337a3e44fb238188f
author: Stefan Pöschel <[email protected]>
date: Fri May 1 14:48:09 EDT 2020

frontend: address compile warning + add missing LF (#50)


--- a/frontend/main.c
+++ b/frontend/main.c
@@ -1047,6 +1047,7 @@
     char *adtsFileName = NULL;
     float seekTo = 0;
     unsigned char header[8];
+    int bread;
     float length = 0;
     FILE *hMP4File;
     char *faad_id_string;
@@ -1300,16 +1301,21 @@
         }
     }
 
-    fread(header, 1, 8, hMP4File);
+    bread = fread(header, 1, 8, hMP4File);
 
     if (! readFromStdin )
       fclose(hMP4File);
 
+    if (bread != 8) {
+        faad_fprintf(stderr, "Error reading file.\n");
+        return 1;
+    }
+
     if (header[4] == 'f' && header[5] == 't' && header[6] == 'y' && header[7] == 'p')
         mp4file = 1;
 
     if (!mp4file && seekTo != 0) {
-        faad_fprintf(stderr, "Warning: can only seek in MP4 files");
+        faad_fprintf(stderr, "Warning: can only seek in MP4 files\n");
     }
 
     if (mp4file)