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
284 if (len == 0)284 if (len == 0)
285 return 0;285 return 0;
286 286
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
287 if (p->pos + len > p->size) {295 if (p->pos + len > p->size) {
288 p->size = ((p->pos + len) / BUFINCR + 1) * BUFINCR;296 p->size = ((p->pos + len) / BUFINCR + 1) * BUFINCR;
289 p->data = lsx_realloc(p->data, p->size);297 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