OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // This is the implementation of decompression of the proposed WOFF Ultra | 5 // This is the implementation of decompression of the proposed WOFF Ultra |
6 // Condensed file format. | 6 // Condensed file format. |
7 | 7 |
8 #include <cassert> | 8 #include <cassert> |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 #include <vector> | 10 #include <vector> |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 if ((flags & kWoff2FlagsTransform) != 0) { | 819 if ((flags & kWoff2FlagsTransform) != 0) { |
820 if (!ReadBase128(file, &transform_length)) { | 820 if (!ReadBase128(file, &transform_length)) { |
821 return OTS_FAILURE(); | 821 return OTS_FAILURE(); |
822 } | 822 } |
823 } | 823 } |
824 uint32_t src_length = transform_length; | 824 uint32_t src_length = transform_length; |
825 if ((flag_byte >> 6) == 1 || (flag_byte >> 6) == 2) { | 825 if ((flag_byte >> 6) == 1 || (flag_byte >> 6) == 2) { |
826 if (!ReadBase128(file, &src_length)) { | 826 if (!ReadBase128(file, &src_length)) { |
827 return OTS_FAILURE(); | 827 return OTS_FAILURE(); |
828 } | 828 } |
829 } else if ((flag_byte >> 6) == kShortFlagsContinue) { | 829 } else if (static_cast<uint32_t>(flag_byte >> 6) == kShortFlagsContinue) { |
830 // The compressed data for this table is in a previuos table, so we set | 830 // The compressed data for this table is in a previuos table, so we set |
831 // the src_length to zero. | 831 // the src_length to zero. |
832 src_length = 0; | 832 src_length = 0; |
833 } | 833 } |
834 // Disallow huge numbers (> 1GB) for sanity. | 834 // Disallow huge numbers (> 1GB) for sanity. |
835 if (src_length > 1024 * 1024 * 1024 || | 835 if (src_length > 1024 * 1024 * 1024 || |
836 transform_length > 1024 * 1024 * 1024 || | 836 transform_length > 1024 * 1024 * 1024 || |
837 dst_length > 1024 * 1024 * 1024) { | 837 dst_length > 1024 * 1024 * 1024) { |
838 return OTS_FAILURE(); | 838 return OTS_FAILURE(); |
839 } | 839 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 if (transform_buf > &uncompressed_buf[0] + uncompressed_buf.size()) { | 1022 if (transform_buf > &uncompressed_buf[0] + uncompressed_buf.size()) { |
1023 return OTS_FAILURE(); | 1023 return OTS_FAILURE(); |
1024 } | 1024 } |
1025 } | 1025 } |
1026 } | 1026 } |
1027 | 1027 |
1028 return FixChecksums(tables, result); | 1028 return FixChecksums(tables, result); |
1029 } | 1029 } |
1030 | 1030 |
1031 } // namespace ots | 1031 } // namespace ots |
OLD | NEW |