View | Details | Raw Unified | Return to bug 273510
Collapse All | Expand All

(-)b/devel/woff2/Makefile (-2 / +7 lines)
Lines 1-9 Link Here
1
PORTNAME=	woff2
1
PORTNAME=	woff2
2
DISTVERSIONPREFIX=	v
2
DISTVERSIONPREFIX=	v
3
DISTVERSION=	1.0.2
3
DISTVERSION=	1.0.2
4
PORTREVISION=	4
4
PORTREVISION=	5
5
CATEGORIES=	devel
5
CATEGORIES=	devel
6
6
7
PATCH_SITES=	https://github.com/google/${PORTNAME}/commit/
8
PATCHFILES=	3831354113db8803fb1f5ba196cf0bbb537578dd.patch:-p1
9
7
MAINTAINER=	gnome@FreeBSD.org
10
MAINTAINER=	gnome@FreeBSD.org
8
COMMENT=	Library and converter tools for the WOFF 2.0 web font format
11
COMMENT=	Library and converter tools for the WOFF 2.0 web font format
9
WWW=		https://github.com/google/woff2
12
WWW=		https://github.com/google/woff2
Lines 13-23 LICENSE_FILE= ${WRKSRC}/LICENSE Link Here
13
16
14
LIB_DEPENDS=	libbrotlidec.so:archivers/brotli
17
LIB_DEPENDS=	libbrotlidec.so:archivers/brotli
15
18
16
USES=		cmake compiler:c++11-lib
19
USES=		cmake compiler:c++11-lib pathfix pkgconfig
17
USE_GITHUB=	yes
20
USE_GITHUB=	yes
18
GH_ACCOUNT=	google
21
GH_ACCOUNT=	google
19
USE_LDCONFIG=	yes
22
USE_LDCONFIG=	yes
20
23
21
PLIST_SUB=	SHLIBVER=${DISTVERSION}
24
PLIST_SUB=	SHLIBVER=${DISTVERSION}
22
25
26
CMAKE_ON=	CMAKE_SKIP_RPATH
27
23
.include <bsd.port.mk>
28
.include <bsd.port.mk>
(-)b/devel/woff2/distinfo (-1 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1522147257
1
TIMESTAMP = 1693634674
2
SHA256 (google-woff2-v1.0.2_GH0.tar.gz) = add272bb09e6384a4833ffca4896350fdb16e0ca22df68c0384773c67a175594
2
SHA256 (google-woff2-v1.0.2_GH0.tar.gz) = add272bb09e6384a4833ffca4896350fdb16e0ca22df68c0384773c67a175594
3
SIZE (google-woff2-v1.0.2_GH0.tar.gz) = 38934
3
SIZE (google-woff2-v1.0.2_GH0.tar.gz) = 38934
4
SHA256 (3831354113db8803fb1f5ba196cf0bbb537578dd.patch) = 28a197486d60897b856ea9706c5a136dc9dc284fbc8db71f5a4367700eefef2e
5
SIZE (3831354113db8803fb1f5ba196cf0bbb537578dd.patch) = 1519
(-)b/devel/woff2/files/patch-coverity_scan (+164 lines)
Added Link Here
1
diff --git a/src/font.cc b/src/font.cc
2
index a45153e..0e9f5bf 100644
3
--- src/font.cc
4
+++ src/font.cc
5
@@ -66,7 +66,7 @@ bool ReadTrueTypeFont(Buffer* file, const uint8_t* data, size_t len,
6
 
7
   std::map<uint32_t, uint32_t> intervals;
8
   for (uint16_t i = 0; i < font->num_tables; ++i) {
9
-    Font::Table table;
10
+    Font::Table table = {};
11
     table.flag_byte = 0;
12
     table.reuse_of = NULL;
13
     if (!file->ReadU32(&table.tag) ||
14
@@ -326,7 +326,7 @@ int NumGlyphs(const Font& font) {
15
     return 0;
16
   }
17
   int index_fmt = IndexFormat(font);
18
-  int loca_record_size = (index_fmt == 0 ? 2 : 4);
19
+  uint32_t loca_record_size = (index_fmt == 0 ? 2 : 4);
20
   if (loca_table->length < loca_record_size) {
21
     return 0;
22
   }
23
diff --git a/src/glyph.h b/src/glyph.h
24
index f24056f..e870188 100644
25
--- src/glyph.h
26
+++ src/glyph.h
27
@@ -22,17 +22,17 @@ namespace woff2 {
28
 // is around.
29
 class Glyph {
30
  public:
31
-  Glyph() : instructions_size(0), composite_data_size(0) {}
32
+  Glyph() {}
33
 
34
   // Bounding box.
35
-  int16_t x_min;
36
-  int16_t x_max;
37
-  int16_t y_min;
38
-  int16_t y_max;
39
+  int16_t x_min = 0;
40
+  int16_t x_max = 0;
41
+  int16_t y_min = 0;
42
+  int16_t y_max = 0;
43
 
44
   // Instructions.
45
-  uint16_t instructions_size;
46
-  const uint8_t* instructions_data;
47
+  uint16_t instructions_size = 0;
48
+  const uint8_t* instructions_data = 0;
49
 
50
   // Data model for simple glyphs.
51
   struct Point {
52
@@ -43,9 +43,9 @@ class Glyph {
53
   std::vector<std::vector<Point> > contours;
54
 
55
   // Data for composite glyphs.
56
-  const uint8_t* composite_data;
57
-  uint32_t composite_data_size;
58
-  bool have_instructions;
59
+  const uint8_t* composite_data = 0;
60
+  uint32_t composite_data_size = 0;
61
+  bool have_instructions = false;
62
 };
63
 
64
 // Parses the glyph from the given data. Returns false on parsing failure or
65
diff --git a/src/normalize.cc b/src/normalize.cc
66
index 6685e08..a819074 100644
67
--- src/normalize.cc
68
+++ src/normalize.cc
69
@@ -97,7 +97,7 @@ bool MakeEditableBuffer(Font* font, int tableTag) {
70
   table->buffer.resize(sz);
71
   uint8_t* buf = &table->buffer[0];
72
   memcpy(buf, table->data, table->length);
73
-  if (PREDICT_FALSE(sz > table->length)) {
74
+  if (PREDICT_FALSE(static_cast<uint32_t>(sz) > table->length)) {
75
     memset(buf + table->length, 0, sz - table->length);
76
   }
77
   table->data = buf;
78
@@ -213,7 +213,6 @@ bool FixChecksums(Font* font) {
79
   size_t offset = 8;
80
   StoreU32(0, &offset, head_buf);
81
   uint32_t file_checksum = 0;
82
-  uint32_t head_checksum = 0;
83
   for (auto& i : font->tables) {
84
     Font::Table* table = &i.second;
85
     if (table->IsReused()) {
86
@@ -221,10 +220,6 @@ bool FixChecksums(Font* font) {
87
     }
88
     table->checksum = ComputeULongSum(table->data, table->length);
89
     file_checksum += table->checksum;
90
-
91
-    if (table->tag == kHeadTableTag) {
92
-      head_checksum = table->checksum;
93
-    }
94
   }
95
 
96
   file_checksum += ComputeHeaderChecksum(*font);
97
diff --git a/src/woff2_dec.cc b/src/woff2_dec.cc
98
index 25e18c6..442baa5 100644
99
--- src/woff2_dec.cc
100
+++ src/woff2_dec.cc
101
@@ -316,7 +316,7 @@ void ComputeBbox(unsigned int n_points, const Point* points, uint8_t* dst) {
102
   offset = Store16(dst, offset, x_min);
103
   offset = Store16(dst, offset, y_min);
104
   offset = Store16(dst, offset, x_max);
105
-  offset = Store16(dst, offset, y_max);
106
+  Store16(dst, offset, y_max);
107
 }
108
 
109
 
110
diff --git a/src/woff2_enc.cc b/src/woff2_enc.cc
111
index ec00878..c0598f8 100644
112
--- src/woff2_enc.cc
113
+++ src/woff2_enc.cc
114
@@ -331,20 +331,17 @@ bool ConvertTTFToWOFF2(const uint8_t *data, size_t length,
115
         return false;
116
       }
117
 
118
-      Table table;
119
+      Table table = {};
120
       table.tag = src_table.tag;
121
       table.flags = src_table.flag_byte;
122
       table.src_length = src_table.length;
123
       table.transform_length = src_table.length;
124
-      const uint8_t* transformed_data = src_table.data;
125
       const Font::Table* transformed_table =
126
           font.FindTable(src_table.tag ^ 0x80808080);
127
       if (transformed_table != NULL) {
128
         table.flags = transformed_table->flag_byte;
129
         table.flags |= kWoff2FlagsTransform;
130
         table.transform_length = transformed_table->length;
131
-        transformed_data = transformed_table->data;
132
-
133
       }
134
       tables.push_back(table);
135
     }
136
@@ -423,8 +420,6 @@ bool ConvertTTFToWOFF2(const uint8_t *data, size_t length,
137
         // for reused tables, only the original has an updated offset
138
         uint32_t table_offset =
139
           table.IsReused() ? table.reuse_of->offset : table.offset;
140
-        uint32_t table_length =
141
-          table.IsReused() ? table.reuse_of->length : table.length;
142
         std::pair<uint32_t, uint32_t> tag_offset(table.tag, table_offset);
143
         if (index_by_tag_offset.find(tag_offset) == index_by_tag_offset.end()) {
144
 #ifdef FONT_COMPRESSION_BIN
145
diff --git a/src/woff2_info.cc b/src/woff2_info.cc
146
index 2b51adc..8ec9d36 100644
147
--- src/woff2_info.cc
148
+++ src/woff2_info.cc
149
@@ -122,13 +122,13 @@ int main(int argc, char **argv) {
150
     if (!woff2::Read255UShort(&file, &numFonts)) return 1;
151
     printf("CollectionHeader 0x%08x %d fonts\n", version, numFonts);
152
 
153
-    for (auto i = 0; i < numFonts; i++) {
154
+    for (auto i = 0u; i < numFonts; i++) {
155
       uint32_t numTables, flavor;
156
       if (!woff2::Read255UShort(&file, &numTables)) return 1;
157
       if (!file.ReadU32(&flavor)) return 1;
158
       printf("CollectionFontEntry %d flavor 0x%08x %d tables\n", i, flavor,
159
           numTables);
160
-      for (auto j = 0; j < numTables; j++) {
161
+      for (auto j = 0u; j < numTables; j++) {
162
         uint32_t table_idx;
163
         if (!woff2::Read255UShort(&file, &table_idx)) return 1;
164
         if (table_idx >= table_tags.size()) return 1;

Return to bug 273510