OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 368 } |
369 if (operands.back().second != DICT_OPERATOR) { | 369 if (operands.back().second != DICT_OPERATOR) { |
370 continue; | 370 continue; |
371 } | 371 } |
372 | 372 |
373 // got operator | 373 // got operator |
374 const uint32_t op = operands.back().first; | 374 const uint32_t op = operands.back().first; |
375 operands.pop_back(); | 375 operands.pop_back(); |
376 | 376 |
377 switch (op) { | 377 switch (op) { |
378 // array | 378 // hints |
379 case 6: // BlueValues | 379 case 6: // BlueValues |
380 case 7: // OtherBlues | 380 case 7: // OtherBlues |
381 case 8: // FamilyBlues | 381 case 8: // FamilyBlues |
382 case 9: // FamilyOtherBlues | 382 case 9: // FamilyOtherBlues |
| 383 if (operands.empty() || (operands.size() % 2) != 0) { |
| 384 return OTS_FAILURE(); |
| 385 } |
| 386 break; |
| 387 |
| 388 // array |
383 case (12U << 8) + 12: // StemSnapH (delta) | 389 case (12U << 8) + 12: // StemSnapH (delta) |
384 case (12U << 8) + 13: // StemSnapV (delta) | 390 case (12U << 8) + 13: // StemSnapV (delta) |
385 if (operands.empty()) { | 391 if (operands.empty()) { |
386 return OTS_FAILURE(); | 392 return OTS_FAILURE(); |
387 } | 393 } |
388 break; | 394 break; |
389 | 395 |
390 // number | 396 // number |
391 case 10: // StdHW | 397 case 10: // StdHW |
392 case 11: // StdVW | 398 case 11: // StdVW |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 delete (font->cff->local_subrs_per_font)[i]; | 1043 delete (font->cff->local_subrs_per_font)[i]; |
1038 } | 1044 } |
1039 delete font->cff->local_subrs; | 1045 delete font->cff->local_subrs; |
1040 delete font->cff; | 1046 delete font->cff; |
1041 } | 1047 } |
1042 } | 1048 } |
1043 | 1049 |
1044 } // namespace ots | 1050 } // namespace ots |
1045 | 1051 |
1046 #undef TABLE_NAME | 1052 #undef TABLE_NAME |
OLD | NEW |