| Index: src/loca.cc
|
| diff --git a/src/loca.cc b/src/loca.cc
|
| index a2947b279922992712e316d478916196e1d033a1..ad74b267354d3f6d9e41517831b5fe3a364920d5 100644
|
| --- a/src/loca.cc
|
| +++ b/src/loca.cc
|
| @@ -76,7 +76,9 @@ bool ots_loca_serialise(OTSStream *out, OpenTypeFile *file) {
|
|
|
| if (head->index_to_loc_format == 0) {
|
| for (unsigned i = 0; i < loca->offsets.size(); ++i) {
|
| - if (!out->WriteU16(loca->offsets[i] >> 1)) {
|
| + const uint16_t offset = static_cast<uint16_t>(loca->offsets[i] >> 1);
|
| + if ((offset != (loca->offsets[i] >> 1)) ||
|
| + !out->WriteU16(offset)) {
|
| return OTS_FAILURE();
|
| }
|
| }
|
|
|