shithub: sox

Download patch

ref: 5735eaec8cbd472854096b9d70dbb96e4e09e829
parent: 18d2609a2362a43928d45bbd806b17ebd7fa8eb8
author: Mans Rullgard <mans@mansr.com>
date: Sat Apr 28 15:05:25 EDT 2018

hcom: limit input size to 2G samples

Better to refuse longer inputs than doing something weird in the
compression code.

--- a/src/hcom.c
+++ b/src/hcom.c
@@ -284,6 +284,14 @@
   if (len == 0)
     return 0;
 
+  if (p->pos == INT32_MAX)
+    return SOX_EOF;
+
+  if (p->pos + len > INT32_MAX) {
+    lsx_warn("maximum file size exceeded");
+    len = INT32_MAX - p->pos;
+  }
+
   if (p->pos + len > p->size) {
     p->size = ((p->pos + len) / BUFINCR + 1) * BUFINCR;
     p->data = lsx_realloc(p->data, p->size);