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

Side by Side Diff: src/cff.cc

Issue 9447013: [OTS] Allow empty Private DICT inside CFF data (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 10 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 | « 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 // 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 "cff.h" 5 #include "cff.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <utility> // std::pair 8 #include <utility> // std::pair
9 #include <vector> 9 #include <vector>
10 10
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 } 753 }
754 if (operands.back().second != DICT_OPERAND_INTEGER) { 754 if (operands.back().second != DICT_OPERAND_INTEGER) {
755 return OTS_FAILURE(); 755 return OTS_FAILURE();
756 } 756 }
757 const uint32_t private_offset = operands.back().first; 757 const uint32_t private_offset = operands.back().first;
758 operands.pop_back(); 758 operands.pop_back();
759 if (operands.back().second != DICT_OPERAND_INTEGER) { 759 if (operands.back().second != DICT_OPERAND_INTEGER) {
760 return OTS_FAILURE(); 760 return OTS_FAILURE();
761 } 761 }
762 const uint32_t private_length = operands.back().first; 762 const uint32_t private_length = operands.back().first;
763 if (private_offset >= table_length) { 763 if (private_offset > table_length) {
764 return OTS_FAILURE(); 764 return OTS_FAILURE();
765 } 765 }
766 if (private_length >= table_length) { 766 if (private_length >= table_length) {
767 return OTS_FAILURE(); 767 return OTS_FAILURE();
768 } 768 }
769 if (private_length + private_offset > table_length) { 769 if (private_length + private_offset > table_length) {
770 // does not overflow since table_length < 1GB 770 // does not overflow since table_length < 1GB
agl 2012/02/23 15:30:55 Note: this comment is nonsensical. It doesn't matt
bashi 2012/02/23 23:36:34 Done.
771 return OTS_FAILURE(); 771 return OTS_FAILURE();
772 } 772 }
773 // parse "15. Private DICT Data" 773 // parse "15. Private DICT Data"
774 if (!ParsePrivateDictData(data, table_length, 774 if (!ParsePrivateDictData(data, table_length,
775 private_offset, private_length, 775 private_offset, private_length,
776 type, out_cff)) { 776 type, out_cff)) {
777 return OTS_FAILURE(); 777 return OTS_FAILURE();
778 } 778 }
779 break; 779 break;
780 } 780 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 } 1001 }
1002 for (size_t i = 0; i < file->cff->local_subrs_per_font.size(); ++i) { 1002 for (size_t i = 0; i < file->cff->local_subrs_per_font.size(); ++i) {
1003 delete (file->cff->local_subrs_per_font)[i]; 1003 delete (file->cff->local_subrs_per_font)[i];
1004 } 1004 }
1005 delete file->cff->local_subrs; 1005 delete file->cff->local_subrs;
1006 delete file->cff; 1006 delete file->cff;
1007 } 1007 }
1008 } 1008 }
1009 1009
1010 } // namespace ots 1010 } // namespace ots
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