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

Side by Side Diff: third_party/sfntly/src/subsetter/subsetter_impl.cc

Issue 7610005: Fortify against corrupted font. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update to resolve DEPS conflict Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « DEPS ('k') | 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 2011 Google Inc. All Rights Reserved. 2 * Copyright 2011 Google Inc. All Rights Reserved.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 UnicodeString font_string = UnicodeString::fromUTF8(font_name); 147 UnicodeString font_string = UnicodeString::fromUTF8(font_name);
148 if (font_string.isEmpty()) 148 if (font_string.isEmpty())
149 return false; 149 return false;
150 UnicodeString regular_suffix = UnicodeString::fromUTF8(" Regular"); 150 UnicodeString regular_suffix = UnicodeString::fromUTF8(" Regular");
151 UnicodeString alt_font_string = font_string; 151 UnicodeString alt_font_string = font_string;
152 alt_font_string += regular_suffix; 152 alt_font_string += regular_suffix;
153 153
154 typedef std::map<int32_t, UnicodeString> NameMap; 154 typedef std::map<int32_t, UnicodeString> NameMap;
155 NameMap names; 155 NameMap names;
156 NameTablePtr name_table = down_cast<NameTable*>(font->GetTable(Tag::name)); 156 NameTablePtr name_table = down_cast<NameTable*>(font->GetTable(Tag::name));
157 if (name_table == NULL) {
158 return false;
159 }
157 160
158 for (int32_t i = 0; i < name_table->NameCount(); ++i) { 161 for (int32_t i = 0; i < name_table->NameCount(); ++i) {
159 switch(name_table->NameId(i)) { 162 switch(name_table->NameId(i)) {
160 case NameId::kFontFamilyName: 163 case NameId::kFontFamilyName:
161 case NameId::kFontSubfamilyName: 164 case NameId::kFontSubfamilyName:
162 case NameId::kFullFontName: 165 case NameId::kFullFontName:
163 case NameId::kPreferredFamily: 166 case NameId::kPreferredFamily:
164 case NameId::kPreferredSubfamily: 167 case NameId::kPreferredSubfamily:
165 case NameId::kWWSFamilyName: 168 case NameId::kWWSFamilyName:
166 case NameId::kWWSSubfamilyName: { 169 case NameId::kWWSSubfamilyName: {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 TableBuilderPtr dereference; 331 TableBuilderPtr dereference;
329 dereference.Attach( 332 dereference.Attach(
330 font_builder->NewTableBuilder(i->first, i->second->ReadFontData())); 333 font_builder->NewTableBuilder(i->first, i->second->ReadFontData()));
331 } 334 }
332 } 335 }
333 336
334 return font_builder->Build(); 337 return font_builder->Build();
335 } 338 }
336 339
337 } // namespace sfntly 340 } // namespace sfntly
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698