History

hcom: limit input size to 2G samples

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

Mans Rullgard committed 8 years ago

Commit 5735eae1 parent 18d26091 file · +8 −0Browse files

Unified · Split

src/hcom.c+8−0
@@ -284,6 +284,14 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t l · 283 unmodified lines
284284 if (len == 0)
285285 return 0;
286286
287+ if (p->pos == INT32_MAX)
288+ return SOX_EOF;
289+
290+ if (p->pos + len > INT32_MAX) {
291+ lsx_warn("maximum file size exceeded");
292+ len = INT32_MAX - p->pos;
293+ }
294+
287295 if (p->pos + len > p->size) {
288296 p->size = ((p->pos + len) / BUFINCR + 1) * BUFINCR;
289297 p->data = lsx_realloc(p->data, p->size);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t