diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp index 75a9a5f9529..af2026e1672 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -34,13 +34,17 @@ class LineBuffer: public StackObj { private: - static const int BUFFER_LEN = 1024; + static const int BUFFER_LEN = 1024*3; static const int INDENT_CHARS = 3; char _buffer[BUFFER_LEN]; int _indent_level; int _cur; void vappend(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) { + if (_cur >= BUFFER_LEN) { + DEBUG_ONLY(warning("previous LineBuffer overflow, request ignored");) + return; + } int res = os::vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap); if (res > BUFFER_LEN) { DEBUG_ONLY(warning("buffer too small in LineBuffer");)