summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2016-05-26Make CPDF_IndirectObjectHolder::InsertIndirectObject return a bool.thestig
Fix some nits in CPDF_Parser::LoadCrossRefV5() and other callers. Review-Url: https://codereview.chromium.org/2019443002
2016-05-26Clean up CPDF_TextRenderer slightly.thestig
- Remove dead code - Remove default arguments - Move code into anonymous namespace Review-Url: https://codereview.chromium.org/2013023002
2016-05-26Remove default arguments in CFX_RenderDevice.thestig
Review-Url: https://codereview.chromium.org/2011943004
2016-05-26Remove default argument from RestoreState() methods.thestig
Review-Url: https://codereview.chromium.org/2009803003
2016-05-25Remove CFX_PrivateData from CPDF_Documenttsepez
Replace it with two generic slots for Links and Codec usage. Since the codec is at a lower layer than the document, we don't provide separate get/set methods, since having a document upon which to call these would be a layering violation. Do the same for the Links for simplicity. Review-Url: https://codereview.chromium.org/2005193003
2016-05-25Remove CFX_PrivateData from CPDF_Pagetsepez
CFX_PrivateData served two purposes here: The first was to hold an opaque pointer to the corresponding page structure in the next higher layer, of which it knows no details. Introduce an empty CPDF_Page::View class to represent this higher class, so as to get type safety while preserving layering. The second was to hold an opaque render context, which it also happened to own. Make this a CFX_Deletable to help with management. Also remove an unused inheritance from CFX_PrivateData in CPDF_Annot. Review-Url: https://codereview.chromium.org/2008553008
2016-05-25get skia buildingcaryclark
Resolve changes to cpdf_shadingpattern.h that prevent Skia from building. R=thestig@chromium.org,dsinclair@chromium.org,reed@google.com BUG= Review-Url: https://codereview.chromium.org/2017463002
2016-05-24Remove CFX_PrivateData from CPDF_ModuleMgrtsepez
Its only used to store one object, so replace it with a unique_ptr to a class with a virtual dtor. Rename the prototypical class with virtual dtor from CFX_DestructObject to CFX_Deletable. Rename the fx_basic_module.cpp to cfx_modulemgr.cpp to match the one class in it. Review-Url: https://codereview.chromium.org/2013483003
2016-05-23Change CPDF_Boolean to use bool instead of FX_BOOL.thestig
Review-Url: https://codereview.chromium.org/1999313002
2016-05-23Distinguish between user and owner passwords.thestig
BUG=pdfium:496 Review-Url: https://codereview.chromium.org/2005653002
2016-05-23Make CPDF_Function::Load() return an unique_ptr.chromium/2750chromium/2749chromium/2748thestig
Review-Url: https://codereview.chromium.org/2000973002
2016-05-23Use unique_ptr in CPDF_CidFonttsepez
Review-Url: https://codereview.chromium.org/2003833003
2016-05-23Delete CPDF_Object::IsModified().thestig
Review-Url: https://codereview.chromium.org/2001933002
2016-05-23Fix infinite recursion in CPDF_DocPageData::GetColorSpace().thestig
BUG=pdfium:497 Review-Url: https://codereview.chromium.org/2003873002
2016-05-21Get rid of CPDF_Object::GetArray().thestig
BUG=pdfium:234 Review-Url: https://codereview.chromium.org/2001783003
2016-05-20Add an enum to represent text rendering modes.thestig
Review-Url: https://codereview.chromium.org/1999553002
2016-05-20Merge GetBits32() impls into one. Put it in fxcrt.thestig
Review-Url: https://codereview.chromium.org/1990153003
2016-05-19Fix the Skia build after 9b1a0ee.thestig
Review-Url: https://codereview.chromium.org/1996533004
2016-05-19Fix Undefined-shift in CPDF_SampledFunc::v_Init().thestig
Also fix a divide by zero in CPDF_SampledFunc. Do some cleanups too. BUG=596530,613032 Review-Url: https://codereview.chromium.org/1990843004
2016-05-19Fix leak in CPDF_StreamContentParser::AddTextObject().thestig
... by using STL containers in more places. Remove dead / duplicate code as well. BUG=603904 Review-Url: https://codereview.chromium.org/1998583002
2016-05-19Clean up CFX_RenderDevice::DrawNormalText().thestig
Review-Url: https://codereview.chromium.org/1990583002
2016-05-17Fix DrMemory bot error by properly initializing the variableweili
The variable needs to be initialized before using. Review-Url: https://codereview.chromium.org/1984323002
2016-05-17Revert of Remove an unnecessary variable from CPDF_Creator (patchset #1 ↵weili
id:20001 of https://codereview.chromium.org/1988603002/ ) Reason for revert: The variable is still needed, will fix the other way. Original issue's description: > Remove an unnecessary variable from CPDF_Creator > > The variable may not be initialized before using, which caused > errors on DrMemory bot. Since it is not necessary, remove it. > > TBR=thestig@chromium.org > > Committed: https://pdfium.googlesource.com/pdfium/+/47b998b53edbb071bb55c909169be1070126fb22 TBR=dsinclair@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/1987783002
2016-05-17Remove an unnecessary variable from CPDF_Creatorweili
The variable may not be initialized before using, which caused errors on DrMemory bot. Since it is not necessary, remove it. TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/1988603002
2016-05-16Fix the code that causes warningsweili
These are the left or newly added code which causes compilation warnings of "signed and unsigned comparison". Need to fix them before I re-enable the warning flag. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/1986533002
2016-05-16Clean up CPDF_Creator.thestig
- Used unique_ptr and initializer list. - Remove variables that never change in value. Review-Url: https://codereview.chromium.org/1976003003
2016-05-13Make CFX_ByteString(const CFX_ByteStringC&) explicit.tsepez
Add missing helper function to CFX_ByteTextBuf to avoid the anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name "Make" to indicate there's an allocation going on in this case. Change some method arguments to take pre-existing ByteStrings where possible. Review-Url: https://codereview.chromium.org/1977093002
2016-05-12Add CFX_ByteStringC::CharAt() to avoid c_str() and casts.tsepez
Most of the time, we want to operate on chars as if they were unsigned, but there are a few places where we need the default (questionably signed) values. Consolidate the casting in a single place rather than forcing callers to get a char* ptr. BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1972053003
2016-05-12Clean up CFX_ImageTransformer.thestig
Review-Url: https://codereview.chromium.org/1973913002
2016-05-11Fix a sign mismatch.chromium/2735thestig
TBR=tsepez@chromium.org Review-Url: https://codereview.chromium.org/1976443002
2016-05-11Revert "Reland of relax a couple checks to allow certain non-standard PDF ↵weili
files. (patchset #1 id:1 of https://codereview.chromium.org/1946693002/ )" This reverts commit a031357eaab7c934ac03717968cf78ff556c819b. The reason to revert it is that some malformed or maliciously crafted PDF files may cause crashes. BUG=610973 Review-Url: https://codereview.chromium.org/1971013002
2016-05-11Add much-needed Find() method for CFX_*StringCtsepez
BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1968233002
2016-05-11Remove c_str() from fpdf_font.cpptsepez
BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1967223002
2016-05-11Use bytestringC rather than raw ptr/len pairs in syntax parsertsepez
In particular, we seek to make more use of the .Mid() (substr) method to make these. Precursor to removing c_str() calls. BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1966293002
2016-05-11Clean up CPDF_Color and some related code.thestig
- Remove dead code in CPDF_Color. - Encapsulate member variables. - Added accessors as need. - Remove unused CPDF_ColorSpace::GetMaxIndex(). - Remove redundent CPDF_StreamContentParser::GetNumber16(). Review-Url: https://codereview.chromium.org/1965243002
2016-05-11Fix a potential UAF with FPDFAvail_IsLinearized().thestig
Cache the linearized result rather than recalculating it. BUG=608778 Review-Url: https://codereview.chromium.org/1968743002
2016-05-04Return bool rather than bitwise-and for FX_BOOLtsepez
Investigate results of: git grep -ni 'return [(]*[a-z0-9_]* &[^&]' git grep -ni 'BOOL.*= [(]*[a-z0-9_]* &[^&]' Review-Url: https://codereview.chromium.org/1951653002
2016-05-04Reland of lax a couple checks to allow certain non-standard PDF files. ↵weili
(patchset #1 id:1 of https://codereview.chromium.org/1946693002/ ) Reason for revert: The culprit was found and confirmed, not this one. Original issue's description: > Revert of Relax a couple checks to allow certain non-standard PDF files. (patchset #1 id:1 of https://codereview.chromium.org/1926823002/ ) > > Reason for revert: > Speculatively revert due to high volume of crashes on Chromium. > > Original issue's description: > > Relax a couple checks to allow certain non-standard PDF files. > > > > Some non-standard PDF files misuse the size of cross reference table, > > and reuse some object number which the old one is still in use. PDFium > > can relax the reusing of xref objects only since it is not referred in > > the pdf document. When the size of cross reference table is larger > > than defined, PDFium will try to continue other than abort. > > > > BUG=chromium:596947 > > > > Committed: https://pdfium.googlesource.com/pdfium/+/cd1e9ff4f432cbc29ed279e6891fb7ddc2ea3734 > > TBR=thestig@chromium.org,dsinclair@chromium.org > # Not skipping CQ checks because original CL landed more than 1 days ago. > BUG=chromium:596947 > > Committed: https://pdfium.googlesource.com/pdfium/+/5fc4f31285c3a88fc157fd2d9b9cf2eb5c7cabed TBR=thestig@chromium.org,dsinclair@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:596947 Review-Url: https://codereview.chromium.org/1947983002
2016-05-03Revert of Relax a couple checks to allow certain non-standard PDF files. ↵weili
(patchset #1 id:1 of https://codereview.chromium.org/1926823002/ ) Reason for revert: Speculatively revert due to high volume of crashes on Chromium. Original issue's description: > Relax a couple checks to allow certain non-standard PDF files. > > Some non-standard PDF files misuse the size of cross reference table, > and reuse some object number which the old one is still in use. PDFium > can relax the reusing of xref objects only since it is not referred in > the pdf document. When the size of cross reference table is larger > than defined, PDFium will try to continue other than abort. > > BUG=chromium:596947 > > Committed: https://pdfium.googlesource.com/pdfium/+/cd1e9ff4f432cbc29ed279e6891fb7ddc2ea3734 TBR=thestig@chromium.org,dsinclair@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=chromium:596947 Review-Url: https://codereview.chromium.org/1946693002
2016-04-29Relax a couple checks to allow certain non-standard PDF files.weili
Some non-standard PDF files misuse the size of cross reference table, and reuse some object number which the old one is still in use. PDFium can relax the reusing of xref objects only since it is not referred in the pdf document. When the size of cross reference table is larger than defined, PDFium will try to continue other than abort. BUG=chromium:596947 Review-Url: https://codereview.chromium.org/1926823002
2016-04-28Fix stack overflow from nested arrays.thestig
BUG=pdfium:422 Review-Url: https://codereview.chromium.org/1930743003
2016-04-27Standardize on ASSERT.dsinclair
There are currently three ways to assert in the code (ASSERT, FXSYS_assert and assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can be overridden if the platform requies and we can pickup the Chromium version if it has already been defined in the build. This does change behaviour. Currently FXSYS_assert is always defined but ASSERT is only defined in debug builds. So, the FXSYS_assert's would fire in Release builds. That will no longer happen. BUG=pdfium:219 Review-Url: https://codereview.chromium.org/1914303003
2016-04-26CPDF_Document::LoadPattern() and friends always have a valid matrix.thestig
So pass by const-ref instead of by pointer. Review URL: https://codereview.chromium.org/1923153002
2016-04-26Move CPDF_Document code into cpdf_document.cpp.thestig
Review URL: https://codereview.chromium.org/1925453002
2016-04-26Remove several IPDF_ interfaces and CPDF_RenderModule.dsinclair
This CL removes the interfaces: * IPDF_ObjectRenderer * IPDF_OCContext * IPDF_RenderModule * IPDF_PageModule The CPDF_RenderModule was just wrapping new and delete calls. This Cl moves those up to the callers and removes the CPDF_RenderModule class. Review URL: https://codereview.chromium.org/1918323003
2016-04-26Clean up CPDF_Page.thestig
- Merge CPDF_Page::Load() into ctor. - Remove always nullptr param for CPDF_Page::ParseContent(). - Remove unneeded indirection in IPDF_RenderModule. - Delete CPDF_ParseOptions. - Fix up CPDF_Pattern. Review URL: https://codereview.chromium.org/1918113002
2016-04-22Add a simple check for V4 cross reference tableweili
Some unknown software generates cross reference table with the claimed object numbers are all off by one. Add a simple verification function to detect this scenario, thus have a chance to rebuild the correct cross reference table. To avoid unnecessary checks and potiential performance hit, we only check for the very first non free entry. BUG=602650 Review URL: https://codereview.chromium.org/1910063004
2016-04-22Remove #ifdef platform which is always true.tsepez
fx_system.h errors out during compile if _FXM_PLATFORM_ is not one of the four values tested in the ifdef. Remove duplicated code, and use unique_ptr for cleanup. Review URL: https://codereview.chromium.org/1912023002
2016-04-21Remove next batch of CFX_ arrays from fpdf_edit_doc.cpptsepez
Review URL: https://codereview.chromium.org/1904303002
2016-04-21Remove more CFX_ArrayTemplate from fpdf_edit_doc.cpptsepez
Review URL: https://codereview.chromium.org/1909213002