Skip to content

Commit

Permalink
Backport 0a81676fae3b25117dd2289a734193bcbee822de
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Feb 7, 2025
1 parent 8012f69 commit 931e647
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/hotspot/share/logging/logDecorators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -100,7 +100,9 @@ bool LogDecorators::parse(const char* decorator_args, outputStream* errstream) {
break;
}
tmp_decorators |= mask(d);
token = comma_pos + 1;
if (comma_pos != nullptr) {
token = comma_pos + 1;
}
} while (comma_pos != nullptr);
os::free(args_copy);
if (result) {
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/logging/logSelection.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -151,7 +151,9 @@ static LogSelection parse_internal(char *str, outputStream* errstream) {
return LogSelection::Invalid;
}
tags[ntags++] = tag;
cur_tag = plus_pos + 1;
if (plus_pos != nullptr) {
cur_tag = plus_pos + 1;
}
} while (plus_pos != nullptr);

for (size_t i = 0; i < ntags; i++) {
Expand Down
8 changes: 6 additions & 2 deletions src/hotspot/share/logging/logSelectionList.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -69,7 +69,7 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) {
}
char* copy = os::strdup_check_oom(str, mtLogging);
// Split string on commas
for (char *comma_pos = copy, *cur = copy; success && comma_pos != nullptr; cur = comma_pos + 1) {
for (char *comma_pos = copy, *cur = copy; success; cur = comma_pos + 1) {
if (_nselections == MaxSelections) {
if (errstream != nullptr) {
errstream->print_cr("Can not have more than " SIZE_FORMAT " log selections in a single configuration.",
Expand All @@ -90,6 +90,10 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) {
break;
}
_selections[_nselections++] = selection;

if (comma_pos == nullptr) {
break;
}
}

os::free(copy);
Expand Down

0 comments on commit 931e647

Please sign in to comment.