Skip to content

Commit

Permalink
Bug 1223002 - Cherry-pick post-1.3.4 bugfixes for graphite2 from upst…
Browse files Browse the repository at this point in the history
…ream. r=jdaggett
  • Loading branch information
jfkthame committed Nov 19, 2015
1 parent f9e9f04 commit 5a7d1f3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions gfx/graphite2/README.mozilla
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
This directory contains the Graphite2 library release 1.3.4 from
https://github.com/silnrsi/graphite/releases/download/1.3.4/graphite2-minimal-1.3.4.tgz
See ./gfx/graphite2/moz-gr-update.sh for update procedure.

Bug 1223002: Updated to upstream commit 6106dcbd5bc4df2e6ef6a7c632c69ca71ba2b518
to fix recently-discovered fuzzbugs.
10 changes: 7 additions & 3 deletions gfx/graphite2/src/Code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class Machine::Code::decoder
analysis _analysis;
enum passtype _passtype;
int _stack_depth;
bool _in_ctxt_item;
};


Expand All @@ -139,7 +140,8 @@ inline Machine::Code::decoder::decoder(limits & lims, Code &code, enum passtype
_pre_context(code._constraint ? 0 : lims.pre_context),
_rule_length(code._constraint ? 1 : lims.rule_length),
_instr(code._code), _data(code._data), _max(lims), _passtype(pt),
_stack_depth(0)
_stack_depth(0),
_in_ctxt_item(false)
{ }


Expand Down Expand Up @@ -356,8 +358,8 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc)
break;
case CNTXT_ITEM :
valid_upto(_max.rule_length, _max.pre_context + int8(bc[0]));
if (bc + 2 + bc[1] >= _max.bytecode) failure(jump_past_end);
if (_pre_context != 0) failure(nested_context_item);
if (bc + 2 + bc[1] >= _max.bytecode) failure(jump_past_end);
if (_in_ctxt_item) failure(nested_context_item);
break;
case ATTR_SET :
case ATTR_ADD :
Expand Down Expand Up @@ -578,6 +580,7 @@ bool Machine::Code::decoder::emit_opcode(opcode opc, const byte * & bc)
if (opc == CNTXT_ITEM)
{
assert(_pre_context == 0);
_in_ctxt_item = true;
_pre_context = _max.pre_context + int8(_data[-2]);
_rule_length = _max.rule_length;

Expand All @@ -596,6 +599,7 @@ bool Machine::Code::decoder::emit_opcode(opcode opc, const byte * & bc)

_rule_length = 1;
_pre_context = 0;
_in_ctxt_item = false;
}
else
{
Expand Down
1 change: 0 additions & 1 deletion gfx/graphite2/src/Face.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ bool Face::runGraphite(Segment *seg, const Silf *aSilf) const
<< "output" << json::array;
for(Slot * s = seg->first(); s; s = s->next())
*dbgout << dslot(seg, s);
seg->finalise(0); // Call this here to fix up charinfo back indexes.
*dbgout << json::close
<< "advance" << seg->advance()
<< "chars" << json::array;
Expand Down
2 changes: 1 addition & 1 deletion gfx/graphite2/src/TtfUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ gid16 CmapSubtable4Lookup(const void * pCmapSubtabel4, unsigned int nUnicodeId,
uint16 nSeg = be::swap(pTable->seg_count_x2) >> 1;

uint16 n;
const uint16 * pLeft, * pMid;
const uint16 * pLeft, * pMid;
uint16 cMid, chStart, chEnd;

if (rangeKey)
Expand Down

0 comments on commit 5a7d1f3

Please sign in to comment.