Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1771)

Unified Diff: src/pdf/SkPDFTypes.cpp

Issue 1152283014: SkPDF: fix name escape code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFTypes.cpp
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 2b2921d3fd6b6df144de4464c6dc689ed3b89c4f..68783a32a6871fbfe2fb6d6dfa0383389b23af6e 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -105,6 +105,9 @@ static SkString escape_name(const char* name, size_t len) {
int count = 0;
const char* const end = &name[len];
for (const char* n = name; n != end; ++n) {
+ if ('\0' == *n) {
bungeman-skia 2015/06/08 15:23:48 If you're doing it this way, you should drop the '
hal.canary 2015/06/08 15:55:24 Done.
+ break; // http://crbug.com/494913
+ }
if (*n < '!' || *n > '~' || strchr(kToEscape, *n)) {
count += 2;
}
@@ -114,6 +117,9 @@ static SkString escape_name(const char* name, size_t len) {
char* s = result.writable_str();
static const char kHex[] = "0123456789ABCDEF";
for (const char* n = name; n != end; ++n) {
+ if ('\0' == *n) {
+ break;
+ }
if (*n < '!' || *n > '~' || strchr(kToEscape, *n)) {
*s++ = '#';
*s++ = kHex[(*n >> 4) & 0xF];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698