gfx/ots signed vs unsigned comparison fixes.# draft
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Sat, 09 Nov 2019 11:00:41 +0900
changeset 81085 da244c1a4acf98ce3cead0fc327688b7ad30acdb
parent 81084 0b813bcef405d04034e141d32c9ea54e4df0ed59
child 81086 f72bf9c6c124c2d841130837c92639dbf5f94cad
push id9744
push userishikawa@yk.rim.or.jp
push dateSat, 09 Nov 2019 02:01:06 +0000
treeherdertry-comm-central@56c83244ac0e [default view] [failures only]
gfx/ots signed vs unsigned comparison fixes.#
mozilla-M-C-023-gfx-ots-signed-vs-unsigned.patch
new file mode 100644
--- /dev/null
+++ b/mozilla-M-C-023-gfx-ots-signed-vs-unsigned.patch
@@ -0,0 +1,73 @@
+# HG changeset patch
+# User ISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
+# Parent  6141411cf855fe50b217c1e2e231a18ffcd44152
+gfx/ots signed vs unsigned comparison fixes.#
+
+diff --git a/gfx/ots/src/cff.cc b/gfx/ots/src/cff.cc
+--- a/gfx/ots/src/cff.cc
++++ b/gfx/ots/src/cff.cc
+@@ -540,17 +540,17 @@ bool ParsePrivateDictData(
+         if (operands.size() < 1) {
+           return OTS_FAILURE();
+         }
+         if (vsindex >= out_cff->region_index_count.size()) {
+           return OTS_FAILURE();
+         }
+         uint16_t k = out_cff->region_index_count.at(vsindex);
+         uint16_t n = operands.back().first;
+-        if (operands.size() < n * (k + 1) + 1) {
++        if (operands.size() < (long unsigned int) n * (k + 1) + 1) {
+           return OTS_FAILURE();
+         }
+         size_t operands_size = operands.size();
+         // Keep the 1st n operands on the stack for the next operator to use
+         // and pop the rest. There can be multiple consecutive blend operator,
+         // so this makes sure the operands of all of them are kept on the
+         // stack.
+         while (operands.size() > operands_size - ((n * k) + 1))
+diff --git a/gfx/ots/src/cff_charstring.cc b/gfx/ots/src/cff_charstring.cc
+--- a/gfx/ots/src/cff_charstring.cc
++++ b/gfx/ots/src/cff_charstring.cc
+@@ -368,39 +368,39 @@ bool ExecuteCharStringOperator(ots::Open
+       return OTS_FAILURE();
+     }
+     if (stack_size != 1) {
+       return OTS_FAILURE();
+     }
+     if (*in_out_have_blend || *in_out_have_visindex) {
+       return OTS_FAILURE();
+     }
+-    if (argument_stack->top() >= cff.region_index_count.size()) {
++    if ((unsigned int) argument_stack->top() >= cff.region_index_count.size()) {
+       return OTS_FAILURE();
+     }
+     *in_out_have_visindex = true;
+     *in_out_vsindex = argument_stack->top();
+     while (!argument_stack->empty())
+       argument_stack->pop();
+     return true;
+   }
+ 
+   case ots::kBlend: {
+     if (!cff2) {
+       return OTS_FAILURE();
+     }
+     if (stack_size < 1) {
+       return OTS_FAILURE();
+     }
+-    if (*in_out_vsindex >= cff.region_index_count.size()) {
++    if ((long unsigned int) *in_out_vsindex >= cff.region_index_count.size()) {
+       return OTS_FAILURE();
+     }
+     uint16_t k = cff.region_index_count.at(*in_out_vsindex);
+     uint16_t n = argument_stack->top();
+-    if (stack_size < n * (k + 1) + 1) {
++    if (stack_size < (long unsigned int)  n * (k + 1) + 1) {
+       return OTS_FAILURE();
+     }
+ 
+     // Keep the 1st n operands on the stack for the next operator to use and
+     // pop the rest. There can be multiple consecutive blend operator, so this
+     // makes sure the operands of all of them are kept on the stack.
+     while (argument_stack->size() > stack_size - ((n * k) + 1))
+       argument_stack->pop();