Tue, 02 Apr 2013 07:40:52 -0700
Merge
1.1 --- a/src/share/vm/oops/symbol.cpp Tue Apr 02 11:28:33 2013 +0200 1.2 +++ b/src/share/vm/oops/symbol.cpp Tue Apr 02 07:40:52 2013 -0700 1.3 @@ -162,7 +162,7 @@ 1.4 const char *ptr = (const char *)&_body[0]; 1.5 int quoted_length = UTF8::quoted_ascii_length(ptr, utf8_length()); 1.6 char* result = NEW_RESOURCE_ARRAY(char, quoted_length + 1); 1.7 - UTF8::as_quoted_ascii(ptr, result, quoted_length + 1); 1.8 + UTF8::as_quoted_ascii(ptr, utf8_length(), result, quoted_length + 1); 1.9 return result; 1.10 } 1.11
2.1 --- a/src/share/vm/utilities/utf8.cpp Tue Apr 02 11:28:33 2013 +0200 2.2 +++ b/src/share/vm/utilities/utf8.cpp Tue Apr 02 07:40:52 2013 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -180,11 +180,12 @@ 2.11 } 2.12 2.13 // converts a utf8 string to quoted ascii 2.14 -void UTF8::as_quoted_ascii(const char* utf8_str, char* buf, int buflen) { 2.15 +void UTF8::as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen) { 2.16 const char *ptr = utf8_str; 2.17 + const char *utf8_end = ptr + utf8_length; 2.18 char* p = buf; 2.19 char* end = buf + buflen; 2.20 - while (*ptr != '\0') { 2.21 + while (ptr < utf8_end) { 2.22 jchar c; 2.23 ptr = UTF8::next(ptr, &c); 2.24 if (c >= 32 && c < 127) { 2.25 @@ -196,6 +197,7 @@ 2.26 p += 6; 2.27 } 2.28 } 2.29 + assert(p < end, "sanity"); 2.30 *p = '\0'; 2.31 } 2.32
3.1 --- a/src/share/vm/utilities/utf8.hpp Tue Apr 02 11:28:33 2013 +0200 3.2 +++ b/src/share/vm/utilities/utf8.hpp Tue Apr 02 07:40:52 2013 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -45,7 +45,7 @@ 3.11 static int quoted_ascii_length(const char* utf8_str, int utf8_length); 3.12 3.13 // converts a utf8 string to quoted ascii 3.14 - static void as_quoted_ascii(const char* utf8_str, char* buf, int buflen); 3.15 + static void as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen); 3.16 3.17 // converts a quoted ascii string to utf8 string. returns the original 3.18 // string unchanged if nothing needs to be done.