shithub: sox

Download patch

ref: 3ae511f8292579ff4aa0ec3a23ea9c18fd0f0994
parent: ded08660c6803be0867963b9005018670684efe7
author: robs <robs>
date: Sun Oct 26 05:18:02 EDT 2008

reserve some bits

--- a/src/sox-fmt.c
+++ b/src/sox-fmt.c
@@ -46,7 +46,8 @@
       lsx_readdw(ft, &comments_bytes))
     return SOX_EOF;
 
-  if (((headers_bytes + 4) & 7) || headers_bytes < FIXED_HDR + comments_bytes) {
+  if (((headers_bytes + 4) & 7) || headers_bytes < FIXED_HDR + comments_bytes ||
+      (num_channels > 65535)) /* Reserve top 16 bits */ {
     lsx_fail_errno(ft, SOX_EHDR, "invalid sox file format header");
     return SOX_EOF;
   }
@@ -94,8 +95,9 @@
   static char const * const names[] = {"sox", NULL};
   static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 32, 0, 0};
   static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
-    "SoX native", names, SOX_FILE_REWIND, startread, lsx_rawread, NULL,
-    write_header, lsx_rawwrite, NULL, lsx_rawseek, write_encodings, NULL, 0
+    "SoX native intermediate format", names, SOX_FILE_REWIND, 
+    startread, lsx_rawread, NULL, write_header, lsx_rawwrite, NULL,
+    lsx_rawseek, write_encodings, NULL, 0
   };
   return &handler;
 }