Git Product home page Git Product logo

pdfium's Issues

pdfium out of bound bug

Bug

Thread 1 "pdfium_test" received signal SIGTRAP, Trace/breakpoint trap.
0x000055555c2ff819 in CFDE_TextOut::Line::GetPieceAtIndex(unsigned long)::$_1::operator()() const () at ../../xfa/fde/cfde_textout.cpp:551
551       CHECK(pdfium::IndexInBounds(pieces_, index));
(gdb) bt
#0  0x000055555c2ff819 in CFDE_TextOut::Line::GetPieceAtIndex(unsigned long)::$_1::operator()() const () at ../../xfa/fde/cfde_textout.cpp:551
#1  0x000055555c2fca4b in CFDE_TextOut::Line::GetPieceAtIndex(unsigned long) () at ../../xfa/fde/cfde_textout.cpp:551
#2  0x000055555c2ff378 in CFDE_TextOut::ReloadLinePiece(CFDE_TextOut::Line*, CFX_RectF const&) () at ../../xfa/fde/cfde_textout.cpp:472
#3  0x000055555c2fc26c in CFDE_TextOut::Reload(CFX_RectF const&) () at ../../xfa/fde/cfde_textout.cpp:446
#4  0x000055555c2fab97 in CFDE_TextOut::DrawLogicText(CFX_RenderDevice*, fxcrt::StringViewTemplate<wchar_t>, CFX_RectF const&) () at ../../xfa/fde/cfde_textout.cpp:291

details

void CFDE_TextOut::ReloadLinePiece(Line* pLine, const CFX_RectF& rect) {
  ......
  while (iPieceIndex < iPieceCount) {
    size_t start = start_char;
    size_t end = pPiece->char_count + start;
    while (start < end) {
      dwBreakStatus = m_pTxtBreak->AppendChar(text_span[start]);
      if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
        RetrievePieces(dwBreakStatus, true, rect, &start_char, &iPieceWidths);

      ++start;
    }
    ++iPieceIndex;   //bug, after the step, the index may equal to iPieceCount, lead to oob
    pPiece = pLine->GetPieceAtIndex(iPieceIndex);
  }
  ......
  m_pTxtBreak->Reset();
}

fix

void CFDE_TextOut::ReloadLinePiece(Line* pLine, const CFX_RectF& rect) {
  ......
  while (iPieceIndex < iPieceCount) {
    if (iPieceIndex != 0 ) pPiece = pLine->GetPieceAtIndex(iPieceIndex);
    size_t start = start_char;
    size_t end = pPiece->char_count + start;
    while (start < end) {
      dwBreakStatus = m_pTxtBreak->AppendChar(text_span[start]);
      if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
        RetrievePieces(dwBreakStatus, true, rect, &start_char, &iPieceWidths);

      ++start;
    }
    ++iPieceIndex;  
  }
  ......
  m_pTxtBreak->Reset();
}

Upstream not tracked

Hello,

This gihub clone does not track the git repo at https://pdfium.googlesource.com/pdfium/.
The last commit on this fork is dated May 13, 2020, whereas the last commit on google git is July 23, 2021.
The delta is currently 14 months, and counting.

It would be nice if this repo would track upstream once again.

Thanks

Layer support?

I need create a pdf, and need many layer in one page. as far as I know, only libpdf can do that, but it costs a fee. so...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.