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

Side by Side Diff: src/sfnt/SkOTTable_name.cpp

Issue 58473002: We always read out of bounds here. Fix that. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkOTTable_name.h" 8 #include "SkOTTable_name.h"
9 9
10 #include "SkEndian.h" 10 #include "SkEndian.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, 61 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02,
62 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 62 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1,
63 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, 63 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
64 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 64 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC,
65 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7, 65 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
66 }; 66 };
67 67
68 static void SkStringFromMacRoman(const uint8_t* macRoman, size_t length, SkStrin g& utf8) { 68 static void SkStringFromMacRoman(const uint8_t* macRoman, size_t length, SkStrin g& utf8) {
69 utf8.reset(); 69 utf8.reset();
70 for (size_t i = 0; i < length; ++i) { 70 for (size_t i = 0; i < length; ++i) {
71 utf8.appendUnichar(macRoman[i] < 0x80 ? macRoman[i] : UnicodeFromMacRoma n[macRoman[i]]); 71 utf8.appendUnichar(macRoman[i] < 0x80 ? macRoman[i]
72 : UnicodeFromMacRoman[macRoman[i] - 0x80]);
72 } 73 }
73 } 74 }
74 75
75 static struct BCP47FromLanguageId { 76 static struct BCP47FromLanguageId {
76 uint16_t languageID; 77 uint16_t languageID;
77 const char* bcp47; 78 const char* bcp47;
78 } 79 }
79 /** The Mac and Windows values do not conflict, so this is currently one single table. */ 80 /** The Mac and Windows values do not conflict, so this is currently one single table. */
80 BCP47FromLanguageID[] = { 81 BCP47FromLanguageID[] = {
81 /** A mapping from Mac Language Designators to BCP 47 codes. 82 /** A mapping from Mac Language Designators to BCP 47 codes.
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (languageIndex >= 0) { 526 if (languageIndex >= 0) {
526 record.language = BCP47FromLanguageID[languageIndex].bcp47; 527 record.language = BCP47FromLanguageID[languageIndex].bcp47;
527 return true; 528 return true;
528 } 529 }
529 530
530 // Unknown language, return the BCP 47 code 'und' for 'undetermined'. 531 // Unknown language, return the BCP 47 code 'und' for 'undetermined'.
531 SkASSERT(false); 532 SkASSERT(false);
532 record.language = "und"; 533 record.language = "und";
533 return true; 534 return true;
534 } 535 }
OLDNEW
« 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