mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 753230 - update graphite2 to upstream rev 978:c418207451a7. r=jdaggett
This commit is contained in:
parent
df87bab10f
commit
4819c5a3e6
@ -307,6 +307,7 @@ opcode Machine::Code::decoder::fetch_opcode(const byte * bc)
|
||||
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);
|
||||
break;
|
||||
case ATTR_SET :
|
||||
case ATTR_ADD :
|
||||
|
@ -102,14 +102,14 @@ bool Pass::readPass(const byte * const pass_start, size_t pass_length, size_t su
|
||||
be::skip<uint16>(p, m_sSuccess + 1);
|
||||
|
||||
// More sanity checks
|
||||
if ( reinterpret_cast<const byte *>(o_rule_map) > pass_end
|
||||
if ( reinterpret_cast<const byte *>(o_rule_map + m_sSuccess*sizeof(uint16)) > pass_end
|
||||
|| p > pass_end)
|
||||
return false;
|
||||
const size_t numEntries = be::peek<uint16>(o_rule_map + m_sSuccess*sizeof(uint16));
|
||||
const byte * const rule_map = p;
|
||||
be::skip<uint16>(p, numEntries);
|
||||
|
||||
if (p > pass_end) return false;
|
||||
if (p + 2 > pass_end) return false;
|
||||
m_minPreCtxt = be::read<uint8>(p);
|
||||
m_maxPreCtxt = be::read<uint8>(p);
|
||||
const byte * const start_states = p;
|
||||
@ -120,7 +120,7 @@ bool Pass::readPass(const byte * const pass_start, size_t pass_length, size_t su
|
||||
be::skip<byte>(p, m_numRules);
|
||||
be::skip<byte>(p); // skip reserved byte
|
||||
|
||||
if (p > pass_end) return false;
|
||||
if (p + 2 > pass_end) return false;
|
||||
const size_t pass_constraint_len = be::read<uint16>(p);
|
||||
const uint16 * const o_constraint = reinterpret_cast<const uint16 *>(p);
|
||||
be::skip<uint16>(p, m_numRules + 1);
|
||||
@ -341,6 +341,26 @@ bool Pass::runFSM(FiniteStateMachine& fsm, Slot * slot) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined GRAPHITE2_NTRACING
|
||||
|
||||
inline
|
||||
Slot * input_slot(const SlotMap & slots, const int n)
|
||||
{
|
||||
Slot * s = slots[slots.context() + n];
|
||||
if (!s->isCopied()) return s;
|
||||
|
||||
return s->prev() ? s->prev()->next() : (s->next() ? s->next()->prev() : slots.segment.last());
|
||||
}
|
||||
|
||||
inline
|
||||
Slot * output_slot(const SlotMap & slots, const int n)
|
||||
{
|
||||
Slot * s = slots[slots.context() + n - 1];
|
||||
return s ? s->next() : slots.segment.first();
|
||||
}
|
||||
|
||||
#endif //!defined GRAPHITE2_NTRACING
|
||||
|
||||
void Pass::findNDoRule(Slot * & slot, Machine &m, FiniteStateMachine & fsm) const
|
||||
{
|
||||
assert(slot);
|
||||
@ -366,18 +386,17 @@ void Pass::findNDoRule(Slot * & slot, Machine &m, FiniteStateMachine & fsm) cons
|
||||
if (r->rule->action->deletes()) fsm.slots.collectGarbage();
|
||||
adjustSlot(adv, slot, fsm.slots);
|
||||
*dbgout << "cursor" << slotid(slot)
|
||||
<< json::close // Close "output" object
|
||||
<< json::close; // Close RuelEvent object
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dbgout << json::close // close "considered" array
|
||||
<< "output" << json::object
|
||||
<< "slots" << json::array << json::close
|
||||
<< "cursor" << slotid(slot->next())
|
||||
<< json::close
|
||||
<< "output" << json::null
|
||||
<< "cursor" << slotid(slot->next())
|
||||
<< json::close;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -398,23 +417,6 @@ void Pass::findNDoRule(Slot * & slot, Machine &m, FiniteStateMachine & fsm) cons
|
||||
|
||||
#if !defined GRAPHITE2_NTRACING
|
||||
|
||||
inline
|
||||
Slot * input_slot(const SlotMap & slots, const int n)
|
||||
{
|
||||
Slot * s = slots[slots.context() + n];
|
||||
if (!s->isCopied()) return s;
|
||||
|
||||
return s->prev() ? s->prev()->next() : s->next()->prev();
|
||||
}
|
||||
|
||||
inline
|
||||
Slot * output_slot(const SlotMap & slots, const int n)
|
||||
{
|
||||
Slot * s = slots[slots.context() + n - 1];
|
||||
return s ? s->next() : slots.segment.first();
|
||||
}
|
||||
|
||||
|
||||
void Pass::dumpRuleEventConsidered(const FiniteStateMachine & fsm, const RuleEntry & re) const
|
||||
{
|
||||
*dbgout << "considered" << json::array;
|
||||
@ -445,11 +447,18 @@ void Pass::dumpRuleEventOutput(const FiniteStateMachine & fsm, const Rule & r, S
|
||||
<< json::close // close Rule object
|
||||
<< json::close // close considered array
|
||||
<< "output" << json::object
|
||||
<< "range" << json::flat << json::object
|
||||
<< "start" << slotid(input_slot(fsm.slots, 0))
|
||||
<< "end" << slotid(last_slot)
|
||||
<< json::close // close "input"
|
||||
<< "slots" << json::array;
|
||||
fsm.slots.segment.positionSlots(0);
|
||||
|
||||
for(Slot * slot = output_slot(fsm.slots, 0); slot != last_slot; slot = slot->next())
|
||||
*dbgout << dslot(&fsm.slots.segment, slot);
|
||||
*dbgout << json::close; // close "slots";
|
||||
*dbgout << json::close // close "slots"
|
||||
<< json::close; // close "output" object
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -213,7 +213,8 @@ size_t Silf::readClassMap(const byte *p, size_t data_len, uint32 version)
|
||||
for (const uint32 *o = m_classOffsets + m_nLinear, * const o_end = m_classOffsets + m_nClass; o != o_end; ++o)
|
||||
{
|
||||
const uint16 * lookup = m_classData + *o;
|
||||
if (lookup[0] == 0 // A LookupClass with no looks is a suspicious thing ...
|
||||
if (*o > max_off - 4 // LookupClass doesn't stretch over max_off
|
||||
|| lookup[0] == 0 // A LookupClass with no looks is a suspicious thing ...
|
||||
|| lookup[0] > (max_off - *o - 4)/2 // numIDs lookup pairs fits within (start of LookupClass' lookups array, max_off]
|
||||
|| lookup[3] != lookup[0] - lookup[1]) // rangeShift: numIDs - searchRange
|
||||
return 0;
|
||||
|
@ -807,13 +807,14 @@ bool HorMetrics(gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, const void
|
||||
// guard against bad glyph id
|
||||
size_t lLsbOffset = sizeof(Sfnt::HorizontalMetric) * cLongHorMetrics +
|
||||
sizeof(int16) * (nGlyphId - cLongHorMetrics); // offset in bytes
|
||||
if (lLsbOffset + 1 >= lHmtxSize) // + 1 because entries are two bytes wide
|
||||
// We test like this as LsbOffset is an offset not a length.
|
||||
if (lLsbOffset > lHmtxSize - sizeof(int16))
|
||||
{
|
||||
nLsb = 0;
|
||||
return false;
|
||||
}
|
||||
nAdvWid = be::swap(phmtx[cLongHorMetrics - 1].advance_width);
|
||||
nLsb = be::peek<int16>(reinterpret_cast<const int16 *>(phmtx) + lLsbOffset);
|
||||
nLsb = be::peek<int16>(reinterpret_cast<const byte *>(phmtx) + lLsbOffset);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1177,7 +1178,7 @@ size_t LocaLookup(gid16 nGlyphId,
|
||||
void * GlyfLookup(const void * pGlyf, size_t nGlyfOffset, size_t nTableLen)
|
||||
{
|
||||
const uint8 * pByte = reinterpret_cast<const uint8 *>(pGlyf);
|
||||
if (nGlyfOffset == size_t(-1) || nGlyfOffset > nTableLen)
|
||||
if (nGlyfOffset == size_t(-1) || nGlyfOffset >= nTableLen)
|
||||
return NULL;
|
||||
return const_cast<uint8 *>(pByte + nGlyfOffset);
|
||||
}
|
||||
|
@ -104,8 +104,6 @@ Machine::stack_t Machine::run(const instr * program,
|
||||
|
||||
{
|
||||
assert(program != 0);
|
||||
// assert(_status == finished);
|
||||
|
||||
|
||||
// Declare virtual machine registers
|
||||
const instr * ip = program-1;
|
||||
|
@ -107,7 +107,6 @@ Machine::stack_t Machine::run(const instr * program,
|
||||
slotref * & is)
|
||||
{
|
||||
assert(program != 0);
|
||||
// assert(_status == finished);
|
||||
|
||||
const stack_t *sp = static_cast<const stack_t *>(
|
||||
direct_run(false, program, data, _stack, is, &_map));
|
||||
|
@ -55,7 +55,8 @@ public:
|
||||
out_of_range_data,
|
||||
jump_past_end,
|
||||
arguments_exhausted,
|
||||
missing_return
|
||||
missing_return,
|
||||
nested_context_item
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -179,7 +179,6 @@ inline void Machine::check_final_stack(const int32 * const sp)
|
||||
if (sp < base) _status = stack_underflow; // This should be impossible now.
|
||||
else if (sp >= limit) _status = stack_overflow; // So should this.
|
||||
else if (sp != base) _status = stack_not_empty;
|
||||
else _status = finished;
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
|
Loading…
Reference in New Issue
Block a user