mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8240629: argfiles parsing broken for argfiles with comment cross 4096 bytes chunk
Reviewed-by: alanb, mchung
This commit is contained in:
parent
aa2be1141d
commit
dc17821807
2 changed files with 30 additions and 8 deletions
|
@ -218,11 +218,12 @@ static char* nextToken(__ctx_args *pctx) {
|
|||
} else if (pctx->state == IN_COMMENT) {
|
||||
while (ch != '\n' && ch != '\r') {
|
||||
nextc++;
|
||||
if (nextc > eob) {
|
||||
if (nextc >= eob) {
|
||||
return NULL;
|
||||
}
|
||||
ch = *nextc;
|
||||
}
|
||||
anchor = nextc + 1;
|
||||
pctx->state = FIND_NEXT;
|
||||
continue;
|
||||
}
|
||||
|
@ -258,6 +259,7 @@ static char* nextToken(__ctx_args *pctx) {
|
|||
continue;
|
||||
}
|
||||
pctx->state = IN_COMMENT;
|
||||
anchor = nextc + 1;
|
||||
break;
|
||||
case '\\':
|
||||
if (pctx->state != IN_QUOTE) {
|
||||
|
@ -293,9 +295,12 @@ static char* nextToken(__ctx_args *pctx) {
|
|||
}
|
||||
|
||||
assert(nextc == eob);
|
||||
if (anchor != nextc) {
|
||||
// not yet return until end of stream, we have part of a token.
|
||||
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
|
||||
// Only need partial token, not comment or whitespaces
|
||||
if (pctx->state == IN_TOKEN || pctx->state == IN_QUOTE) {
|
||||
if (anchor < nextc) {
|
||||
// not yet return until end of stream, we have part of a token.
|
||||
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue