Mercurial > hg > truffle
comparison src/share/vm/compiler/compilerOracle.cpp @ 6900:bf14ed159fb0
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
author | kvn |
---|---|
date | Wed, 23 May 2012 12:11:25 -0700 |
parents | 1e76463170b3 |
children | fe4a4ea5bed9 |
comparison
equal
deleted
inserted
replaced
6157:84e198dc2474 | 6900:bf14ed159fb0 |
---|---|
570 if (stream == NULL) return; | 570 if (stream == NULL) return; |
571 | 571 |
572 char token[1024]; | 572 char token[1024]; |
573 int pos = 0; | 573 int pos = 0; |
574 int c = getc(stream); | 574 int c = getc(stream); |
575 while(c != EOF) { | 575 while(c != EOF && pos < (sizeof(token)-1)) { |
576 if (c == '\n') { | 576 if (c == '\n') { |
577 token[pos++] = '\0'; | 577 token[pos++] = '\0'; |
578 parse_from_line(token); | 578 parse_from_line(token); |
579 pos = 0; | 579 pos = 0; |
580 } else { | 580 } else { |
591 void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*)) { | 591 void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*)) { |
592 char token[1024]; | 592 char token[1024]; |
593 int pos = 0; | 593 int pos = 0; |
594 const char* sp = str; | 594 const char* sp = str; |
595 int c = *sp++; | 595 int c = *sp++; |
596 while (c != '\0') { | 596 while (c != '\0' && pos < (sizeof(token)-1)) { |
597 if (c == '\n') { | 597 if (c == '\n') { |
598 token[pos++] = '\0'; | 598 token[pos++] = '\0'; |
599 parse_line(token); | 599 parse_line(token); |
600 pos = 0; | 600 pos = 0; |
601 } else { | 601 } else { |