comparison src/share/vm/compiler/compileBroker.cpp @ 17567:5656140324ed

8030763: Validate global memory allocation Summary: Add length checks where necessary Reviewed-by: coleenp, mschoene
author hseigel
date Thu, 13 Feb 2014 11:28:17 -0500
parents 78da3894b86f
children 3eed8712d410 364b73402247
comparison
equal deleted inserted replaced
17566:bf4dc2e29b5c 17567:5656140324ed
1 /* 1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
2087 // Record this compilation for debugging purposes. 2087 // Record this compilation for debugging purposes.
2088 void CompileBroker::set_last_compile(CompilerThread* thread, methodHandle method, bool is_osr, int comp_level) { 2088 void CompileBroker::set_last_compile(CompilerThread* thread, methodHandle method, bool is_osr, int comp_level) {
2089 ResourceMark rm; 2089 ResourceMark rm;
2090 char* method_name = method->name()->as_C_string(); 2090 char* method_name = method->name()->as_C_string();
2091 strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length); 2091 strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length);
2092 _last_method_compiled[CompileBroker::name_buffer_length - 1] = '\0'; // ensure null terminated
2092 char current_method[CompilerCounters::cmname_buffer_length]; 2093 char current_method[CompilerCounters::cmname_buffer_length];
2093 size_t maxLen = CompilerCounters::cmname_buffer_length; 2094 size_t maxLen = CompilerCounters::cmname_buffer_length;
2094 2095
2095 if (UsePerfData) { 2096 if (UsePerfData) {
2096 const char* class_name = method->method_holder()->name()->as_C_string(); 2097 const char* class_name = method->method_holder()->name()->as_C_string();