mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-08 12:06:40 -04:00
dfffile: handle invalid channels and rate
Missing or malformed headers could cause unspecified channels or rate that can cause crashes.
This commit is contained in:
parent
57770c7e18
commit
b5d294eab0
1 changed files with 7 additions and 0 deletions
|
|
@ -186,6 +186,8 @@ static int read_FRM8(struct dff_file *f)
|
|||
break;
|
||||
case FOURCC('D', 'S', 'D', ' '):
|
||||
{
|
||||
if (f->info.channels == 0)
|
||||
return -EINVAL;
|
||||
f->info.length = c[1].size;
|
||||
f->info.samples = c[1].size / f->info.channels;
|
||||
f->info.lsb = 0;
|
||||
|
|
@ -221,6 +223,11 @@ static int open_read(struct dff_file *f, const char *filename, struct dff_file_i
|
|||
if ((res = read_FRM8(f)) < 0)
|
||||
goto exit_close;
|
||||
|
||||
if (f->info.channels == 0 || f->info.rate == 0) {
|
||||
res = -EINVAL;
|
||||
goto exit_close;
|
||||
}
|
||||
|
||||
f->blocksize = BLOCKSIZE * f->info.channels;
|
||||
f->buffer = calloc(1, f->blocksize);
|
||||
if (f->buffer == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue