7158801: Improve VM CompileOnly option

Wed, 23 May 2012 12:11:25 -0700

author
kvn
date
Wed, 23 May 2012 12:11:25 -0700
changeset 4211
bf14ed159fb0
parent 3860
84e198dc2474
child 4212
fe4a4ea5bed9

7158801: Improve VM CompileOnly option
Summary: Fixed buffer overflow during parsing flags -XX:CompileCommand=, -XX:CompileOnly= and command lines in .hotspot_compiler file.
Reviewed-by: never

src/share/vm/compiler/compilerOracle.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/compiler/compilerOracle.cpp	Mon May 21 14:56:33 2012 -0700
     1.2 +++ b/src/share/vm/compiler/compilerOracle.cpp	Wed May 23 12:11:25 2012 -0700
     1.3 @@ -572,7 +572,7 @@
     1.4    char token[1024];
     1.5    int  pos = 0;
     1.6    int  c = getc(stream);
     1.7 -  while(c != EOF) {
     1.8 +  while(c != EOF && pos < (sizeof(token)-1)) {
     1.9      if (c == '\n') {
    1.10        token[pos++] = '\0';
    1.11        parse_from_line(token);
    1.12 @@ -593,7 +593,7 @@
    1.13    int  pos = 0;
    1.14    const char* sp = str;
    1.15    int  c = *sp++;
    1.16 -  while (c != '\0') {
    1.17 +  while (c != '\0' && pos < (sizeof(token)-1)) {
    1.18      if (c == '\n') {
    1.19        token[pos++] = '\0';
    1.20        parse_line(token);

mercurial