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

Side by Side Diff: third_party/woff2/src/woff2_dec.cc

Issue 1895043002: WOFF2: avoid a Msan error use-of-uninitialized-value in woff2_dec.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update (address upstream review comments) Created 4 years, 8 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
« no previous file with comments | « third_party/woff2/README.chromium ('k') | 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 2014 Google Inc. All Rights Reserved. 1 // Copyright 2014 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 596 }
597 597
598 // TODO(user) Old code aligned glyphs ... but do we actually need to? 598 // TODO(user) Old code aligned glyphs ... but do we actually need to?
599 if (PREDICT_FALSE(!Pad4(out))) { 599 if (PREDICT_FALSE(!Pad4(out))) {
600 return FONT_COMPRESSION_FAILURE(); 600 return FONT_COMPRESSION_FAILURE();
601 } 601 }
602 602
603 *glyf_checksum += ComputeULongSum(glyph_buf.get(), glyph_size); 603 *glyf_checksum += ComputeULongSum(glyph_buf.get(), glyph_size);
604 604
605 // We may need x_min to reconstruct 'hmtx' 605 // We may need x_min to reconstruct 'hmtx'
606 Buffer x_min_buf(glyph_buf.get() + 2, 2); 606 if (n_contours > 0) {
607 int16_t x_min; 607 Buffer x_min_buf(glyph_buf.get() + 2, 2);
608 if (PREDICT_FALSE(!x_min_buf.ReadS16(&x_min))) { 608 if (PREDICT_FALSE(!x_min_buf.ReadS16(&info->x_mins[i]))) {
609 return FONT_COMPRESSION_FAILURE(); 609 return FONT_COMPRESSION_FAILURE();
610 }
610 } 611 }
611
612 info->x_mins[i] = n_contours != 0 ? x_min : 0;
613 } 612 }
614 613
615 // glyf_table dst_offset was set by ReconstructFont 614 // glyf_table dst_offset was set by ReconstructFont
616 glyf_table->dst_length = out->Size() - glyf_table->dst_offset; 615 glyf_table->dst_length = out->Size() - glyf_table->dst_offset;
617 loca_table->dst_offset = out->Size(); 616 loca_table->dst_offset = out->Size();
618 // loca[n] will be equal the length of the glyph data ('glyf') table 617 // loca[n] will be equal the length of the glyph data ('glyf') table
619 loca_values[info->num_glyphs] = glyf_table->dst_length; 618 loca_values[info->num_glyphs] = glyf_table->dst_length;
620 if (PREDICT_FALSE(!StoreLoca(loca_values, info->index_format, loca_checksum, 619 if (PREDICT_FALSE(!StoreLoca(loca_values, info->index_format, loca_checksum,
621 out))) { 620 out))) {
622 return FONT_COMPRESSION_FAILURE(); 621 return FONT_COMPRESSION_FAILURE();
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 hdr.uncompressed_size, 1355 hdr.uncompressed_size,
1357 &metadata, &hdr, i, out))) { 1356 &metadata, &hdr, i, out))) {
1358 return FONT_COMPRESSION_FAILURE(); 1357 return FONT_COMPRESSION_FAILURE();
1359 } 1358 }
1360 } 1359 }
1361 1360
1362 return true; 1361 return true;
1363 } 1362 }
1364 1363
1365 } // namespace woff2 1364 } // namespace woff2
OLDNEW
« no previous file with comments | « third_party/woff2/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698