Browse Source

check requested buffer size and limit to 1..16384 - avoids wierd behaviour caused by jack_bufsize foobar

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4128 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.120.1
paul 14 years ago
parent
commit
8cf46ee70b
2 changed files with 16 additions and 1 deletions
  1. +4
    -0
      libjack/client.c
  2. +12
    -1
      tools/bufsize.c

+ 4
- 0
libjack/client.c View File

@@ -2547,6 +2547,10 @@ jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes)

VALGRIND_MEMSET (&req, 0, sizeof (req));

if (nframes < 1 || nframes > 16384) {
return ERANGE;
}

req.type = SetBufferSize;
req.x.nframes = nframes;



+ 12
- 1
tools/bufsize.c View File

@@ -64,12 +64,23 @@ void parse_arguments(int argc, char *argv[])
exit(9);
}

if (strspn (argv[1], "0123456789") != strlen (argv[1])) {
fprintf(stderr, "usage: %s <bufsize>\n", package);
exit(8);
}

nframes = strtoul(argv[1], NULL, 0);
if (errno == ERANGE) {
fprintf(stderr, "%s: invalid buffer size: %s\n",
fprintf(stderr, "%s: invalid buffer size: %s (range is 1-16384)\n",
package, argv[1]);
exit(2);
}
if (nframes < 1 || nframes > 16384) {
fprintf(stderr, "%s: invalid buffer size: %s (range is 1-16384)\n",
package, argv[1]);
exit(3);
}
}

void silent_function( const char *ignore )


Loading…
Cancel
Save