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

Side by Side Diff: src/post.cc

Issue 68173026: Allowing post area names to be >32767. (Closed) Base URL: https://chromium.googlesource.com/external/ots.git@master
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
« no previous file with comments | « no previous file | test/BLACKLIST.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "post.h" 5 #include "post.h"
6 6
7 #include "maxp.h" 7 #include "maxp.h"
8 8
9 // post - PostScript 9 // post - PostScript
10 // http://www.microsoft.com/opentype/otspec/post.htm 10 // http://www.microsoft.com/opentype/otspec/post.htm
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (num_glyphs != file->maxp->num_glyphs) { 69 if (num_glyphs != file->maxp->num_glyphs) {
70 // Note: Fixedsys500c.ttf seems to have inconsistent num_glyphs values. 70 // Note: Fixedsys500c.ttf seems to have inconsistent num_glyphs values.
71 return OTS_FAILURE(); 71 return OTS_FAILURE();
72 } 72 }
73 73
74 post->glyph_name_index.resize(num_glyphs); 74 post->glyph_name_index.resize(num_glyphs);
75 for (unsigned i = 0; i < num_glyphs; ++i) { 75 for (unsigned i = 0; i < num_glyphs; ++i) {
76 if (!table.ReadU16(&post->glyph_name_index[i])) { 76 if (!table.ReadU16(&post->glyph_name_index[i])) {
77 return OTS_FAILURE(); 77 return OTS_FAILURE();
78 } 78 }
79 if (post->glyph_name_index[i] >= 32768) { 79 // Note: A strict interpretation of the specification requires name indexes
80 // Note: droid_arialuni.ttf fails this test. 80 // are less than 32768. This, however, excludes fonts like unifont.ttf
81 return OTS_FAILURE(); // reserved area. 81 // which cover all of unicode.
82 }
83 } 82 }
84 83
85 // Now we have an array of Pascal strings. We have to check that they are all 84 // Now we have an array of Pascal strings. We have to check that they are all
86 // valid and read them in. 85 // valid and read them in.
87 const size_t strings_offset = table.offset(); 86 const size_t strings_offset = table.offset();
88 const uint8_t *strings = data + strings_offset; 87 const uint8_t *strings = data + strings_offset;
89 const uint8_t *strings_end = data + length; 88 const uint8_t *strings_end = data + length;
90 89
91 for (;;) { 90 for (;;) {
92 if (strings == strings_end) break; 91 if (strings == strings_end) break;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 171 }
173 172
174 return true; 173 return true;
175 } 174 }
176 175
177 void ots_post_free(OpenTypeFile *file) { 176 void ots_post_free(OpenTypeFile *file) {
178 delete file->post; 177 delete file->post;
179 } 178 }
180 179
181 } // namespace ots 180 } // namespace ots
OLDNEW
« no previous file with comments | « no previous file | test/BLACKLIST.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698