Subject: hcom: validate dictsize
From: Helmut Grohne <helmut () subdivi de>

This patch fixes both CVE-2021-23159 and CVE-2021-23172.

--- a/src/hcom.c
+++ b/src/hcom.c
@@ -134,6 +134,11 @@
                 return (SOX_EOF);
         }
         lsx_readw(ft, &dictsize);
+        if (dictsize == 0 || dictsize > 511)
+        {
+                lsx_fail_errno(ft, SOX_EHDR, "Implausible dictionary size in HCOM header");
+                return SOX_EOF;
+        }
 
         /* Translate to sox parameters */
         ft->encoding.encoding = SOX_ENCODING_HCOM;