Attachment #9401577: nsTextFragment-SetTo-failure.patch for bug #1896555

View | Details | Raw Unified | Return to bug 1896555
Collapse All | Expand All

(-)a/dom/base/nsTextFragment.cpp (-1 / +12 lines)
Line     Link Here 
 Lines 191-196   static inline int32_t FirstNon8Bit(const char16_t* str, const char16_t* end) { Link Here 
191
  return FirstNon8BitUnvectorized(str, end);
191
  return FirstNon8BitUnvectorized(str, end);
192
}
192
}
193
193
194
int runCount = 0;
195
194
bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength,
196
bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength,
195
                           bool aUpdateBidi, bool aForce2b) {
197
                           bool aUpdateBidi, bool aForce2b) {
196
  if (MOZ_UNLIKELY(aLength > NS_MAX_TEXT_FRAGMENT_LENGTH)) {
198
  if (MOZ_UNLIKELY(aLength > NS_MAX_TEXT_FRAGMENT_LENGTH)) {
 Lines 296-303   bool nsTextFragment::SetTo(const char16_t* aBuffer, uint32_t aLength, Link Here 
296
      return false;
298
      return false;
297
    }
299
    }
298
300
299
    m2b = nsStringBuffer::Alloc(m2bSize.value()).take();
301
    runCount++;
302
    
303
    if(runCount == 452) {
304
      m2b = nullptr;
305
    } else {
306
      m2b = nsStringBuffer::Alloc(m2bSize.value()).take();
307
    }
308
309
    // 
300
    if (!m2b) {
310
    if (!m2b) {
311
      printf("!m2b at %d\n", runCount);
301
      return false;
312
      return false;
302
    }
313
    }
303
    memcpy(m2b->Data(), aBuffer, aLength * sizeof(char16_t));
314
    memcpy(m2b->Data(), aBuffer, aLength * sizeof(char16_t));

Return to bug 1896555